1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-04 20:40:57 +02:00

33604: fix change merging for vi mode where a change has just been undone

This commit is contained in:
Oliver Kiddle 2014-11-05 22:50:48 +01:00
parent 4b66ec003f
commit c7ff843ecf
4 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2014-11-05 Oliver Kiddle <opk@zsh.org>
* 33604: Src/Zle/zle_utils.c, Src/Zle/zle_vi.c, Test/X02zlevi.ztst:
fix change merging for vi mode where a change has just been undone
2014-11-04 Oliver Kiddle <opk@zsh.org>
* 33596: Src/Zle/zle_keymap.c: make local keymap keybinding hide

View file

@ -1395,7 +1395,8 @@ static struct change *nextchanges, *endnextchanges;
/* incremented to provide a unique change number */
static zlong undo_changeno;
/**/
zlong undo_changeno;
/* If non-zero, the last increment to undo_changeno was for the variable */
@ -1668,8 +1669,7 @@ splitundo(char **args)
{
if (vistartchange >= 0) {
mergeundo();
vistartchange = (curchange && curchange->prev) ?
curchange->prev->changeno : 0;
vistartchange = undo_changeno;
}
handleundo();
return 0;

View file

@ -109,7 +109,7 @@ startvitext(int im)
{
startvichange(im);
selectkeymap("main", 1);
vistartchange = (curchange && curchange->prev) ? curchange->prev->changeno : 0;
vistartchange = undo_changeno;
viinsbegin = zlecs;
}
@ -403,7 +403,7 @@ vichange(UNUSED(char **args))
forekill(c2 - zlecs, CUT_RAW);
selectkeymap("main", 1);
viinsbegin = zlecs;
vistartchange = (curchange && curchange->prev) ? curchange->prev->changeno : 0;
vistartchange = undo_changeno;
}
return ret;
}

View file

@ -205,6 +205,12 @@
zletest $'pre\eA123\C-_\C-y\eu'
0:undo and redo in insert mode, undo in command
>BUFFER: pre
>CURSOR: 2
zletest $'two\eOone\eo\euo\eu'
0:undo starting with a next change in the change list
>BUFFER: one
>two
>CURSOR: 2
zpty_run 'bindkey "^Gu" split-undo'