summaryrefslogtreecommitdiff
path: root/security/putty/patches/patch-al
blob: 98c81f4d8fd36a64f2a46d5c48101c145826bf3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$NetBSD: patch-al,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: 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) {