1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-22 16:20:23 +02:00

13633: don't use termcap cursor keys if single key which is already bound

This commit is contained in:
Peter Stephenson 2001-03-14 12:20:17 +00:00
parent 64819aedac
commit 2d442fff86
2 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2001-03-14 Peter Stephenson <pws@csr.com>
* 13633: Src/Zle/zle_keymap.c: lastest in saga: don't use
termcap suggestion for keymap if it is a single key already bound
by default (user bindings will take precedence anyway).
2001-03-13 Bart Schaefer <schaefer@zsh.org>
* Zvi Har'El: 13619: Completion/User/_rcs: Add the D qualifier

View file

@ -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);
}