5

Currently I'm running dvtm inside a terminal, and vim inside dvtm. When I press Ctrl+z intending to suspend vim, dvtm got suspended instead. I didn't have this problem with screen or tmux, so I think it must be dvtm doing something wrong (or not doing something right). How can I fix that?

Update: I was wrong, this is not a problem with dvtm. Indeed I was using the dtach+dvtm combo and wrongly assumed that dvtm was at fault. The problem is really with dtach.

phunehehe
  • 20,030
  • 27
  • 99
  • 151

1 Answers1

8

Update (new answer):

dtach has a -z option with the description "Disable processing of the suspend key". Confusing if you ask me, but its effect seems to be that the Ctrl+Z is passed through to Vim instead of being caught by dtach.

More general answer: a program like dtach or dvtm has pretty much absolute control over what gets passed through to whatever's running "inside" of it. It's like having a secretary take dictation -- you can say what you like, but the secretary controls what actually appears on the paper. So if you want the end program to receive the Ctrl+Z, you have to get all of the middle layers to cooperate, whether that be through command line options or source code editing.


Looks to me like this is a bug in dvtm. From inspection of the source code, it's not catching the SIGTSTP signal, which is what is sent to your terminal's foreground application when you press Ctrl+z. Since it's not catching the signal explicitly, it falls back on default behavior and gets suspended. What dvtm needs to do is catch this signal and pass it along to one of its windows.

Jander
  • 16,272
  • 6
  • 50
  • 66
  • Thanks for your effort, but sorry it was my mistake. `dtach` is the one responsible for this, not `dvtm`. – phunehehe Feb 18 '11 at 02:15
  • @Gilles: You're right, and on further inspection, `dvtm` does what you've described. And now that I've actually tried it instead of just assuming things and poking around in the source, I'm seeing the correct behavior as well. – Jander Feb 18 '11 at 02:17