$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) {
