Index: windows/window.c =================================================================== --- windows/window.c (revision 8466) +++ windows/window.c (working copy) @@ -4189,8 +4189,17 @@ p += sprintf((char *) p, "\x1BO%c", code + 'P' - 11); return p - output; } - if (cfg.rxvt_homeend && (code == 1 || code == 4)) { - p += sprintf((char *) p, code == 1 ? "\x1B[H" : "\x1BOw"); + /* Home/End */ + if (code == 1 || code == 4) { + /* 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 (cfg.rxvt_homeend) + he = code == 1 ? "\x1B[7~" : "\x1B[8~"; + else + he = code == 1 ? "\x1BOH" : "\x1BOF"; + p += sprintf((char *) p, he); return p - output; } if (code) { 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' */ Index: unix/gtkwin.c =================================================================== --- unix/gtkwin.c (revision 8466) +++ unix/gtkwin.c (working copy) @@ -979,9 +979,17 @@ use_ucsoutput = FALSE; goto done; } - if (inst->cfg.rxvt_homeend && (code == 1 || code == 4)) { - end = 1 + sprintf(output+1, code == 1 ? "\x1B[H" : "\x1BOw"); - use_ucsoutput = FALSE; + /* Home/End */ + if (code == 1 || code == 4) { + /* 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 (inst->cfg.rxvt_homeend) + he = code == 1 ? "\x1B[7~" : "\x1B[8~"; + else + he = code == 1 ? "\x1BOH" : "\x1BOF"; + end = 1 + sprintf(output+1, he); goto done; } if (code) {