Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: History Up key

Peter Stephenson wrote:
>+	/*
>+	 * 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);
>     }

Rather dodgy logic here.  Surely we should be doing all-terminfo arrow
keys or all-VT100 arrow keys, not some combination.

And if we're going the way of arrow keys being bound by default, let's
have some documentation on how to remove those bindings, and let's make
it feasible.  With this kind of logic in place (whether on a key-by-key
basis or affecting the whole set), simply unbinding the terminfo-derived
key sequences isn't sufficient.  In fact, with the logic in the form
you propose above, there is no way to determine whether a binding of
a single-character arrow-key sequence comes from the arrow key or from
the default map, short of knowing the default map.

I suggest in any case a simplification that will ameliorate this problem:
just don't bind single-character arrow-key sequences, rather than only
avoiding such sequences that are already bound.


Messages sorted by: Reverse Date, Date, Thread, Author