'inccommand': Restore cursor/view if cancelled.

Restore cursor position and window "view", if command is cancelled.
This is how 'incsearch' works.
This commit is contained in:
Justin M. Keyes
2016-11-10 15:47:14 +01:00
parent 2e1217da46
commit 795f2bb9b9
2 changed files with 32 additions and 21 deletions

View File

@@ -1599,6 +1599,16 @@ static int command_line_changed(CommandLineState *s)
&& cmd_is_live(ccline.cmdbuff)) {
// process a "live" command ('inccommand')
do_cmdline(ccline.cmdbuff, NULL, NULL, DOCMD_KEEPLINE|DOCMD_LIVE);
// restore the window "view"
curwin->w_cursor = s->old_cursor;
curwin->w_curswant = s->old_curswant;
curwin->w_leftcol = s->old_leftcol;
curwin->w_topline = s->old_topline;
curwin->w_topfill = s->old_topfill;
curwin->w_botline = s->old_botline;
update_topline();
redrawcmdline();
}