diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-05-08 18:01:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-08 18:01:21 +0200 |
commit | 8330cc22afec67d9dbc2ad8b4a39eaf62fdf16d1 (patch) | |
tree | e22baa51856201ff97e2167a82a37a625ab6d20d /src/nvim/fileio.c | |
parent | d36ef9339f398988d4ccefd4780b2f289b0c7f83 (diff) | |
download | rneovim-8330cc22afec67d9dbc2ad8b4a39eaf62fdf16d1.tar.gz rneovim-8330cc22afec67d9dbc2ad8b4a39eaf62fdf16d1.tar.bz2 rneovim-8330cc22afec67d9dbc2ad8b4a39eaf62fdf16d1.zip |
vim-patch:8.1.1205: BufReadPre may move the cursor #9980
Problem: A BufReadPre autocommand may cause the cursor to move.
Solution: Restore the cursor position after executing the autocommand,
unless the autocommand moved it. (Christian Brabandt,
closes vim/vim#4302, closes vim/vim#4294)
https://github.com/vim/vim/commit/a68e59590905da9b4448ff1fcac929ad1a18da9e
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 416d7f5cce..717ae6e602 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -7072,6 +7072,8 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, do_cmdline(NULL, getnextac, (void *)&patcmd, DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT); + reset_lnums(); // restore cursor and topline, unless they were changed + if (eap != NULL) { (void)set_cmdarg(NULL, save_cmdarg); set_vim_var_nr(VV_CMDBANG, save_cmdbang); |