summaryrefslogtreecommitdiff
path: root/security/putty/patches/patch-an
blob: 398024755b1e0af104277e3fd2c5cd9798232292 (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
29
$NetBSD: patch-an,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: 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) {