zsh-workers
 help / color / mirror / code / Atom feed
* Multibyte read errors on self-insert
@ 2015-09-13  3:42 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2015-09-13  3:42 UTC (permalink / raw)
  To: zsh-workers

Peter's patch in workers/36496 included this bit of selfinsert():

 #ifdef MULTIBYTE_SUPPORT
-    if (!lastchar_wide_valid)
-       if (getrestchar(lastchar) == WEOF)
-           return 1;
+    DPUTS(!lastchar_wide_valid, "keybuf did not read full wide character");
 #endif

It's trivial to cause this warning to appear starting from zsh -f:

torch% autoload zed
torch% zed -f pickle
pickle() {
}

Now move the cursor to the beginning of the line with the "}" and press
TAB.  In addition to the warning, a newline is inserted instead of a tab.

91: Src/Zle/zle_misc.c:118: keybuf did not read full wide character

This is because selfinsert() was called from expandorcomplete(), so the
special cases in getkeymapcmd() do not apply.  There are a bunch of
places where selfinsert() may be entered indirectly, so I think the
easiest thing is to back out that hunk of the patch even though it is
redundant in the pure self-insert widget case.


diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 297dc4c..0483f75 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -115,7 +115,10 @@ selfinsert(UNUSED(char **args))
     ZLE_CHAR_T tmp;
 
 #ifdef MULTIBYTE_SUPPORT
-    DPUTS(!lastchar_wide_valid, "keybuf did not read full wide character");
+    /* may be redundant with getkeymapcmd(), but other widgets call here too */
+    if (!lastchar_wide_valid)
+	if (getrestchar(lastchar, NULL, NULL) == WEOF)
+	    return 1;
 #endif
     tmp = LASTFULLCHAR;
     doinsert(&tmp, 1);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-13  3:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-13  3:42 Multibyte read errors on self-insert Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).