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

Re: Bug in ZSH's vi emulation



On Nov 2,  5:51pm, Oliver Kiddle wrote:
}
} We've also got a separate issue of only lastchar being stuffed into
} vichgbuf so repeating, e.g. gU doesn't work. Why is keybuflen only
} 1 in startvichange? That, along with what the general point of lastchar
} is, has me fairly puzzled.

It's because of getkeymapcmd():

    if(lastlen != keybuflen) {
	unmetafy(keybuf + lastlen, &keybuflen);		<-- here
	ungetbytes(keybuf+lastlen, keybuflen);
	if(vichgflag)
	    vichgbufptr -= keybuflen;
	keybuf[lastlen] = 0;
    }

Seems like it ought to do the following?  Or else use a temporary instead
of stomping on keybuflen.

diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 3db4207..b5244b5 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1622,7 +1622,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
 	ungetbytes(keybuf+lastlen, keybuflen);
 	if(vichgflag)
 	    vichgbufptr -= keybuflen;
-	keybuf[lastlen] = 0;
+	keybuf[keybuflen = lastlen] = 0;
     }
     *funcp = func;
     *strp = str;



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