Skip to main content
28 events
when toggle format what by license comment
May 20, 2019 at 19:59 comment added Keith Thompson @vinc17: I have a Debian 9.9.0 VM with xterm version 327-2. Under xterm, Backspace sends ^? and Control-H sends ^H. With my usual X resources setup (XTerm*backarrowKey: True and XTerm*backarrowKeyIsErase: False), both Backspace and Ctrl-H send ^H (\x08). (If Control-H sent anything other than ^H, I'd consider that a bug.) This is all with TERM=xterm.
May 20, 2019 at 11:56 comment added vinc17 @KeithThompson Note: I've just noticed that under Debian, xterm has a patch to change ^H to \177 for Backspace in some of its termcap/terminfo settings, as it is expected that the Backspace key sends the DEL character. This may have an influence on the applications.
Apr 4, 2019 at 0:01 comment added Keith Thompson @vinc17: Thanks for the information. I'm not sure I'm going to spend time tracking this down, since I have a solution that works for me.
Apr 3, 2019 at 23:25 comment added vinc17 @KeithThompson Under Debian/unstable, where DEL is the erase character and the Backspace sends this character, I don't have the issue you're describing with tmux: When I run tmux, then type "cat" (to get the cooked mode), then type Ctrl-H, ^H is displayed as expected. If this is not your case, there may be a bug somewhere on your machine or some of your configuration is incorrect (maybe an old configuration file).
Apr 3, 2019 at 1:20 comment added Keith Thompson @vinc17 Outside of tmux, I might have my terminal emulator and tty settings configured to treat DEL as the erase character. I might even set things up so that the Backspace key on my keyboard sends the DEL character (^?, 0x7f). And I might still want to be able to send the Control-H character (ASCII BS, 0x08) from my keyboard -- for example as the Help command in emacs. If I can send every ASCII character except 0x08, then that's a problem. Again, I'm not asking about an "erase character". (And Doug Morse's answer solves that for me.)
Apr 3, 2019 at 1:01 comment added vinc17 @KeithThompson If you want to be able to send the ^H character (e.g. by typing Ctrl-h), you need to make sure that: if the real terminal has ^H as the erase character, then the terminal under tmux also has ^H as the erase character. And more generally, you need to make sure that the erase character outside and inside tmux is the same if you want to be able to send every character; if this is not the case, you'll get an annoying character translation by tmux.
Apr 3, 2019 at 0:51 comment added Keith Thompson @vinc17: So what if I want to send the ^H (ASCII BS) character? I'm not asking how to send an erase character, I'm asking how to send ASCII BS, 0x08.
Apr 3, 2019 at 0:31 comment added vinc17 @KeithThompson In tmux, Ctrl-h sends the DEL character (^?) when in the real terminal (outside tmux), ^H is the erase character but in tmux, ^? is the erase character. To avoid that, make sure that the erase character is the same in the real terminal and inside tmux (see stty -a output). I suggest that it be ^? as this is the most common configuration nowadays. This also means that the terminal emulator (Xterm, etc.) needs to be configured so that the Backspace key sends this character.
Apr 2, 2019 at 23:04 comment added Keith Thompson I've just started using Doug Morse's solution; I haven't tried this one. A question: With this solution, does Control-H still send the DEL key? If so, that's a real problem. Control-H isn't just backspace; it's also, for example, the Help command in emacs. Whatever you use as your erase character, there should be some way to send a ^H character from the keyboard.
May 24, 2016 at 14:02 comment added i336_ @x-yuri: Hi - just passing through (while reading with great curiosity), and wanted to mention that the link you mentioned in comment 3 has unfortunately broken. (I have no idea what it points to; also, the Web Archive snapshot redirects to an auth login. >.>)
Jan 22, 2015 at 19:47 vote accept x-yuri
Jan 21, 2015 at 22:40 comment added vinc17 @x-yuri If tmux forces erase = ^? and the terminfo used by tmux has kbs=^H, then it is a bug in tmux, which you should report. By cat, I mean the cat command (with no arguments, and not redirecting stdin). If erase = ^H in the real terminal (e.g. your xterm) and erase = ^? in the emulated terminal (GNU Screen or tmux), then ^H should be translated to ^? to make cooked mode work (GNU Screen is buggy in this respect: run xterm + screen, detach, resume in GNOME Terminal, run cat, try the Backspace key); but in raw mode, this translation is visible.
Jan 21, 2015 at 22:17 comment added vinc17 @x-yuri The VT100.backarrowKey user setting is taken into account only if backarrowKeyIsErase is false (I don't think this is specific to Debian, but I'm not sure and you can try). So, the xterm(1) man page seems incorrect and I've reported a bug: Debian bug 775952. If you set *ttyModes: erase ^? with backarrowKeyIsErase being true, then the Backspace key should yield ^?. Setting backarrowKeyIsErase to true (default) allows one to ensure that the Backspace key does an erase in cooked mode.
Jan 21, 2015 at 9:07 comment added x-yuri ...Speaking of "Consistent BackSpace...", my xterm by default produces ^[[3~ for Delete key. So, Ctrl-h -> ^H, Backspace -> ^H, Delete -> ^[[3~. And what's strange, doing xterm*ttyModes: erase ^? without *backarrowKey: false doesn't break the behavior of Backspace key. Somehow, I don't like the idea of changing terminfo database... After all, it reflects xterm's default configuration.
Jan 21, 2015 at 8:44 comment added x-yuri ...The translation is needed in case you use a terminal with ^? as the erase character, then resume the session with a terminal that uses ^H as the erase character. Do you mean in case I run tmux and then detach from it? Unfortunately this has visible side effects in some cases, e.g. if you type Ctrl+H. What exactly has side effects? Or which side effects exactly? Note that you can do stty erase '^?' in xterm... it may break the behavior of the Backspace key). It won't if I do it in ~/.Xresources: xterm*ttyModes: erase ^?
Jan 21, 2015 at 8:43 comment added x-yuri ...so that erasing works as expected in cooked mode (for instance, what happens when you just type cat). Are you talking about running cat? Or typing a word "cat"? Then it might be any word, I suppose. As far as I understand, when in cooked mode programs gets the whole line, not separate characters. With erase characters in it being preprocessed. So, when I press Ctrl-h, tmux translates it to ^? so that the other part of tmux that emulates screen would delete a character before the cursor. Or that's what it looks like to me now.
Jan 21, 2015 at 8:40 comment added x-yuri Actually, the part about "cooked mode" became even more fuzzy. It's still not clear from your explanation why tmux has to translate ^H to ^?. But that must be because tmux emulates screen, which has erase = ^? in tmux (but not in terminfo again). I expected you to elaborate on how inputted keys are processed. Say, I press Ctrl-h. Then the pressed key is processed by xterm. Then, by tmux, which translates it. Or when tmux is running, xterm doesn't do any processing?
Jan 21, 2015 at 8:25 review Suggested edits
Jan 21, 2015 at 8:59
Jan 20, 2015 at 22:51 history edited vinc17 CC BY-SA 3.0
reference to Anne Baretta's page "Consistent BackSpace and Delete Configuration"
Jan 20, 2015 at 22:38 history edited vinc17 CC BY-SA 3.0
more information in the first paragraph
Jan 20, 2015 at 22:31 history edited vinc17 CC BY-SA 3.0
minor change
Jan 20, 2015 at 22:29 comment added vinc17 @x-yuri Hmm... Indeed the official ncurses still has ^H for xterm-256color, and Debian has a fix (difficult to see since this is not via a patch). I've edited my answer to correct that and say what can be done in your case. I've also added an example for the cooked mode.
Jan 20, 2015 at 22:23 history edited vinc17 CC BY-SA 3.0
added example about the cooked mode
Jan 20, 2015 at 19:39 comment added x-yuri A relevant link.
Jan 20, 2015 at 19:26 comment added x-yuri you need to make sure to use a TERM value for which kbs=\177; this is true for xterm-256color: And now that is false, but it is as it should be, isn't it? Or your terminfo database might be not so fresh. So, "misconfiguration" must be coming from terminfo database in the end.
Jan 20, 2015 at 19:24 comment added x-yuri Could you elaborate on "so that erasing works as expected in cooked mode" part? Who and in which turn processes inputted keys? This is not the default configuration, AFAIK. I don't seem to configure it this way, and it's arch linux, so it's unlikely coming from distribution...
Jan 20, 2015 at 17:26 history edited vinc17 CC BY-SA 3.0
completed answer
Jan 20, 2015 at 17:20 history answered vinc17 CC BY-SA 3.0