Along with the arrow keys, xterm sends different sequences for the Home and End keys depending on whether it is in "normal cursor keys" mode or "application cursor keys" mode.
tmux puts xterm clients into "normal cursor keys" mode or "application cursor keys" mode, depending on the active pane's "application keypad" mode (initially, "normal cursor keys" mode via rmkx in tty_start_tty; then "tracking the active pane" via smkx or rmkx in tty_update_mode from server_client_reset_state). However, the xterm terminfo entry only provides the "application cursor keys" mode sequences (in khome and kend). Thus, tmux will fail to recognize a client xterm's Home and End key sequences unless the active pane is in "application keypad mode". This inconsistent recognition is a problem if Home or End are used as a prefix or in a binding: it may be impossible to type the prefix or trigger the binding. It may also cause problems for programs running in a pane: (unless they send screen's smkx sequence, which they really should!) they will see the foreign xterm-style "normal cursor keys" mode sequences for Home and End (e.g. Home's "^[[H" leaks through tmux as two keystrokes: "M-[" and "H") instead of being translated to the *different* screen-style sequences. This inconsistency does not happen for the arrow keys because tty_default_raw_keys supplies "hard coded" support for both variants of the arrow key sequences. To fix this problem for Home and End, give them similar support. According to xterm's ctlseqs documentation, these are the only other keys affected by the cursor keys mode. Another approach would be to always put the client terminal in "keyboard transmit" mode (smkx). It looks like tmux actually operated like this in the past, but it was changed to the current "track the pane mode" in OpenBSD patchset 579 (2009-12-04, ddb5bb80 in the current Git repository). --- tty-keys.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tty-keys.c b/tty-keys.c index 575920e..25e0ef8 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -82,6 +82,13 @@ const struct tty_default_key_raw tty_default_raw_keys[] = { { "\033[C", KEYC_RIGHT }, { "\033[D", KEYC_LEFT }, + /* Other (xterm) "cursor" keys */ + { "\033OH", KEYC_HOME }, + { "\033OF", KEYC_END }, + + { "\033[H", KEYC_HOME }, + { "\033[F", KEYC_END }, + /* rxvt-style arrow + modifier keys. */ { "\033Oa", KEYC_UP|KEYC_CTRL }, { "\033Ob", KEYC_DOWN|KEYC_CTRL }, -- 1.8.1.3 ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users