aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-11-10 15:47:14 +0100
committerJustin M. Keyes <justinkz@gmail.com>2016-11-10 18:09:48 +0100
commit795f2bb9b9b4de2d503e7d792bf6a3c47f92b8c5 (patch)
tree187d5514db88a12a1067343043ad544402498bd2 /src/nvim/ex_getln.c
parent2e1217da4617c832afcd7ca90c88b06c200dc23b (diff)
downloadrneovim-795f2bb9b9b4de2d503e7d792bf6a3c47f92b8c5.tar.gz
rneovim-795f2bb9b9b4de2d503e7d792bf6a3c47f92b8c5.tar.bz2
rneovim-795f2bb9b9b4de2d503e7d792bf6a3c47f92b8c5.zip
'inccommand': Restore cursor/view if cancelled.
Restore cursor position and window "view", if command is cancelled. This is how 'incsearch' works.
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 8ddb1047c7..c4169f03f0 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -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();
}