Bug 153942 - sysutils/tmux patch breaks backspace in tmux command mode
Summary: sysutils/tmux patch breaks backspace in tmux command mode
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Wen Heping
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-13 01:30 UTC by Brandon Low
Modified: 2011-05-25 01:31 UTC (History)
0 users

See Also:


Attachments
smime.p7s (3.93 KB, application/x-pkcs7-signature)
2011-01-13 02:36 UTC, Brandon Low
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brandon Low 2011-01-13 01:30:08 UTC
Due to the patch file /usr/ports/sysutils/tmux/files/patch-tty-keys.c the backspace key does not work in <C-b>: mode (tmux command mode).

Fix: 

For me, removing the file /usr/ports/sysutils/tmux/files/patch-tty-keys.c and running make uninstall; make clean install on tmux fixed the problem for me, but I don't know why the patch existed in the first place, I can only assume that its existance was to fix a bug for another user.
How-To-Repeat: cd /usr/ports/sysutils/tmux
make clean install
tmux
<C-b>:
type anything, then try to backspace
Comment 1 Brandon Low 2011-01-13 02:36:20 UTC
Here's an email that I received from the maintainer of tmux about this
issue, indicating that it should be safe to remove the patch nowadays:

the reason they did that is because at least some freebsd versions have                                                                
xterm etc generate ^H by default and have ^H as verase in termios (stty)                                                               
                                                                                                                                       
tmux always sends ^? as backspace to programs inside, but earlier                                                                      
versions did not change the termios inside to set verase to ^?                                                                         
                                                                                                                                       
new versions do, so outside can have verase=^H, tmux will detect that is                                                               
backspace (from termios) and translate it to ^? inside as well as                                                                      
setting verase to ^? in new windows so applications inside tmux use the                                                                
right thing                                                                                                                            
                                                                                                                                       
this is all because terminfo kbs is too unreliable and so many                                                                         
applications just blindly accept ^? anyway                                                                                             
                                                                                                                                       
since your terminal on freebsd sends ^? (and termios is ^? too) either                                                                 
you're using a terminal which uses that by default, you changed the                                                                    
xterm deleteIsDEL property (like everyone else does), or freebsd changed                                                               
their default 
Comment 2 swell.k 2011-01-13 04:32:05 UTC
Brandon Low <lostlogic@lostlogicx.com> writes:

> Here's an email that I received from the maintainer of tmux about this
> issue, indicating that it should be safe to remove the patch nowadays:
>
> the reason they did that is because at least some freebsd versions have
> xterm etc generate ^H by default and have ^H as verase in termios (stty)
>
> tmux always sends ^? as backspace to programs inside, but earlier
> versions did not change the termios inside to set verase to ^?
>
> new versions do, so outside can have verase=^H, tmux will detect that is
> backspace (from termios) and translate it to ^? inside as well as

And this magic translation has a bug, you can't disable it. Run from
inside tmux

  $ stty erase '^H'

then try to use backspace key or Ctrl-H in ncurses apps. It'd still
produce '^?'. That's because there's actually no way to type '^H'.
Any other erase character would work fine.

> setting verase to ^? in new windows so applications inside tmux use the
> right thing
>
> this is all because terminfo kbs is too unreliable and so many
> applications just blindly accept ^? anyway

'^H' is also a valid character for Ctrl-H. Without tty-keys.c patch
there is one keycode less as both Ctrl-H and Ctrl-? produce '^?'.
And any (default) keybinding with '^H' doesn't work.

>
> since your terminal on freebsd sends ^? (and termios is ^? too) either
> you're using a terminal which uses that by default, you changed the
> xterm deleteIsDEL property (like everyone else does), or freebsd changed
> their default
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2011-01-13 09:53:54 UTC
Responsible Changed
From-To: freebsd-ports-bugs->wen

Fix synopsis and assign.
Comment 4 Wen Heping freebsd_committer freebsd_triage 2011-05-25 01:31:43 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!