On Aug 20 16:44, Corinna Vinschen wrote: > On Aug 20 16:06, Corinna Vinschen wrote: > > I'm just a bit puzzled about the key codes. By default, when rxvt is > > invoked without explicitely setting the terminal name (-tn option), > > rxvt is recognized as an xterm. The cursor keys correctly return > > ESC [ A to ESC [ D. However, the Home and End keys return ESC [ 7 ~ > > and ESC [ 8 ~, while a real xterm returns ESC [ H and ESC [ F. > > > > Ok, so I set the terminal to rxvt-cygwin-native as suggested in the > > README file. > > > > Now the Home and End keys are ok, because the termcap/terminfo entry > > for these keys is matching. However, the termcap/terminfo entries > > expect ESC O A to ESC O D for the cursor keys but, as I wrote above, > > rxvt returns the xterm sequences ESC [ A to ESC [ D, so the cursor > > keys don't work anymore. > > On further looking into this, it appears that the termcap/terminfo > entries are wrong. ESC O A to ESC O D are only generated after > entering the DEC expanded cursor mode with ESC [ ? 1 h. The default > codes are ESC [ A to ESC [ D. It's not clear to me why the > termcap/terminfo entries list the expanded mode sequences instead of > the standard sequences.
I'd like to suggest the below patch. It aligns the handling of Home and End key to its xterm counterparts. That doesn't solve the problem with the rxvt-cygwin-native termcap/terminfo entries, but it let rxvt work better in default xterm mode. Home and End now generate the vt102/vt220/xterm sequence ESC [ H and ESC [ F. After switching to the DEC extended cursor mode, they generate ESC O H and ESC O F, same as vt102/vt220/xterm. Corinna --- command.c.ORIG 2007-08-20 16:51:43.419482700 +0200 +++ command.c 2007-08-20 16:55:20.632170700 +0200 @@ -465,6 +465,8 @@ rxvt_lookup_key(rxvt_t *r, XKeyEvent *ev #endif case XK_End: STRCPY(kbuf, KS_END); + if (r->h->PrivateModes & PrivMode_aplCUR) + kbuf[1] = 'O'; break; #ifdef XK_KP_Home case XK_KP_Home: @@ -477,6 +479,8 @@ rxvt_lookup_key(rxvt_t *r, XKeyEvent *ev #endif case XK_Home: STRCPY(kbuf, KS_HOME); + if (r->h->PrivateModes & PrivMode_aplCUR) + kbuf[1] = 'O'; break; #define FKEY(n, fkey) \ --- command.h.ORIG 2007-08-20 16:56:10.099082700 +0200 +++ command.h 2007-08-20 16:56:20.687946700 +0200 @@ -38,8 +38,8 @@ # define KS_HOME "\033[1~" /* Home == Find */ # define KS_END "\033[4~" /* End == Select */ #else -# define KS_HOME "\033[7~" /* Home */ -# define KS_END "\033[8~" /* End */ +# define KS_HOME "\033[H" /* Home */ +# define KS_END "\033[F" /* End */ #endif #ifdef SCROLL_ON_SHIFT -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat