1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 23:11:20 +02:00

32342: fix overstrike for vi mode and use varying vi commands at line start

This commit is contained in:
Oliver Kiddle 2014-02-05 21:55:18 +01:00
parent 2cd3b9ab74
commit e1bc9d0a44
3 changed files with 15 additions and 10 deletions

@ -1,5 +1,8 @@
2014-02-05 Oliver Kiddle <opk@zsh.org>
* 32342: Src/Zle/zle_main.c, Src/Zle/zle_vi.c: fix overstrike for vi
mode and use varying vi commands at line start
* 32334 (modified so KEEPSUFFIX is unchanged for vi-cmd-mode; based on
Jun T: 32324, 32330), 32347, Jun T: 32344, 32349: Src/Zle/iwidgets.list,
Src/Zle/zle_main.c, Src/Zle/zle_utils.c, Src/Zle/zle_vi.c

@ -1198,14 +1198,6 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
statusline = NULL;
selectkeymap("main", 1);
initundo();
/*
* If main is linked to the viins keymap, we need to register
* explicitly that we're now in vi insert mode as there's
* no user operation to indicate this.
*/
if (openkeymap("main") == openkeymap("viins"))
viinsert_init();
selectlocalmap(NULL);
fixsuffix();
if ((s = getlinknode(bufstack))) {
setline(s, ZSL_TOEND);
@ -1222,6 +1214,14 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
stackhist = -1;
}
}
/*
* If main is linked to the viins keymap, we need to register
* explicitly that we're now in vi insert mode as there's
* no user operation to indicate this.
*/
if (openkeymap("main") == openkeymap("viins"))
viinsert_init();
selectlocalmap(NULL);
if (isset(PROMPTCR))
putc('\r', shout);
if (tmout)

@ -79,8 +79,9 @@ static void
startvichange(int im)
{
if (im != -1) {
insmode = im;
vichgflag = 1;
if (im > -1)
insmode = im;
}
if (inrepeat && im != -2) {
zmod = lastmod;
@ -92,7 +93,8 @@ startvichange(int im)
free(vichgbuf);
vichgbuf = (char *)zalloc(vichgbufsz = 16);
if (im == -2) {
vichgbuf[0] = 'a';
vichgbuf[0] =
zlell ? (insmode ? (zlecs < zlell ? 'i' : 'a') : 'R') : 'o';
} else {
vichgbuf[0] = lastchar;
}