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

Re: Possible bug with bindkey and Unicode characters in 5.2?



On Mon, 07 Dec 2015 15:47:16 -0500
"Raymond W. Ko" <raymond.w.ko@xxxxxxxxx> wrote:
> bindkey -s θ '"\C-b"'
> bindkey -s ω "'\C-b'"
> bindkey -s υ ">\C-b<"
> bindkey -s σ "}\C-b{"
> bindkey -s φ ")\C-b("
> bindkey -s φ "asdf"
> bindkey -s ρ "]\C-b["
> 
> On zsh 5.1 and 5.0.1, this works as expected. However, in 5.2 there 
> seems to be a pause for half a second before a question mark appears.

Yes, this is a general problem.  This fix should be good enough.

I think there will be slight hiccups when there are a mixture of key
bindings for multibyte sequences and self-insert characters beginning
with the same bytes, but that's inevitable to some extent --- this should
certainly be no worse than before.  Bart ensured that even if we do
eventually need a self-insert it will work the way it always did, which
was fine in most cases, just a bit icky if you really needed the full
character to be inserted in good time.

(A volunteer to pick up ZLE testing would be useful.  Felix did quite a
lot of work on this some time ago which no one ever had the time to
merge.)

pws

diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 069580f..d6d116b 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1503,7 +1503,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
 		    f->widget->flags & ZLE_VIOPER);
 #ifdef MULTIBYTE_SUPPORT
 	    if ((f == Th(z_selfinsert) || f == Th(z_selfinsertunmeta)) &&
-		!lastchar_wide_valid) {
+		!lastchar_wide_valid && !ispfx) {
 		int len;
 		VARARR(char, mbc, MB_CUR_MAX);
 		ZLE_INT_T inchar = getrestchar(lastchar, mbc, &len);



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