about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-03-14 12:20:17 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-03-14 12:20:17 +0000
commit2d442fff86d643cadd16315639f17644feb08f5e (patch)
treecd825ce5bdc6ff6ec020e59db1e7b7fe4cc6d548 /Src/Zle
parent64819aedac3e85ffc15f8aacc052009820434f49 (diff)
downloadzsh-2d442fff86d643cadd16315639f17644feb08f5e.tar.gz
zsh-2d442fff86d643cadd16315639f17644feb08f5e.tar.xz
zsh-2d442fff86d643cadd16315639f17644feb08f5e.zip
13633: don't use termcap cursor keys if single key which is already bound
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_keymap.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index b46c74f91..c6646450d 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1029,6 +1029,7 @@ static void
 add_cursor_key(Keymap km, int tccode, Thingy thingy, int defchar)
 {
     char buf[2048];
+    int ok = 0;
 
     /*
      * Be careful not to try too hard with bindings for dubious or
@@ -1042,7 +1043,18 @@ add_cursor_key(Keymap km, int tccode, Thingy thingy, int defchar)
 	cursorptr = buf;
 	tputs(tcstr[tccode], 1, add_cursor_char);
 	*cursorptr = '\0';
-    } else {
+
+	/*
+	 * Sanity checking.  If the cursor key is zero-length (unlikely,
+	 * but this is termcap we're talking about), or it's a single
+	 * character which is already bound, then we don't bind it.
+	 */
+	if (!buf[0] || (!buf[1] && km->first[STOUC(buf[0])] != t_undefinedkey))
+	    ok = 0;
+	else
+	    ok = 1;
+    }
+    if (!ok) {
 	/* Assume the normal VT100-like values. */
 	sprintf(buf, "\33[%c", defchar);
     }