From a8c4ed64ee684227c0dd3142e912f7faca8bd1fb Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 31 Jan 2014 14:01:12 +0100 Subject: 32314: merge undo events corresponding to vi change in the vi-cmd-mode widget so undo from insert mode is useful again --- Src/Zle/zle_vi.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Src/Zle/zle_vi.c') diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c index 31f293387..9e9cc2f34 100644 --- a/Src/Zle/zle_vi.c +++ b/Src/Zle/zle_vi.c @@ -107,7 +107,7 @@ startvitext(int im) { startvichange(im); selectkeymap("main", 1); - undoing = 0; + vistartchange = (curchange && curchange->prev) ? curchange->prev->changeno : 0; viinsbegin = zlecs; } @@ -399,7 +399,7 @@ vichange(UNUSED(char **args)) forekill(c2 - zlecs, CUT_RAW); selectkeymap("main", 1); viinsbegin = zlecs; - undoing = 0; + vistartchange = curchange->prev->changeno; } return ret; } @@ -584,7 +584,13 @@ vicmdmode(UNUSED(char **args)) { if (invicmdmode() || selectkeymap("vicmd", 0)) return 1; - undoing = 1; + struct change *current = curchange->prev; + while (current && current->changeno > vistartchange+1) { + current->flags |= CH_PREV; + current = current->prev; + if (!current) break; + current->flags |= CH_NEXT; + } vichgflag = 0; if (zlecs != findbol()) DECCS(); -- cgit v1.2.3