$NetBSD: patch-am,v 1.1 2009/02/25 18:08:01 roy Exp $ Make the home/end keys work on BSD servers as well as Linux ones Index: terminal.c =================================================================== --- terminal.c (revision 8466) +++ terminal.c (working copy) @@ -6131,13 +6131,6 @@ } } - /* RXVT Home/End */ - if (term->cfg.rxvt_homeend && - (keysym == PK_HOME || keysym == PK_END)) { - p += sprintf((char *) p, keysym == PK_HOME ? "\x1B[H" : "\x1BOw"); - goto done; - } - if (term->vt52_mode) { int xkey; @@ -6158,11 +6151,23 @@ goto done; } + /* Home/End */ + if (keysym == PK_HOME || keysym == PK_END) { + /* Send the correct XTerm or rxvt codes for home/end + * We used to send ^[1~ and [4~ for Xterm, + * but those are Linux console */ + const char *he; + if (term->cfg.rxvt_homeend) + he = keysym == PK_HOME ? "\x1B[7~" : "\x1B[8~"; + else + he = keysym == PK_HOME ? "\x1BOH" : "\x1BOF"; + p += sprintf((char *) p, he); + goto done; + } + switch (keysym) { - case PK_HOME: code = 1; break; case PK_INSERT: code = 2; break; case PK_DELETE: code = 3; break; - case PK_END: code = 4; break; case PK_PAGEUP: code = 5; break; case PK_PAGEDOWN: code = 6; break; default: code = 0; break; /* else gcc warns `enum value not used' */