diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-02-04 10:58:34 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-02-04 10:58:34 +0000 |
commit | 49f0524fb575bb1cf4881e472afab7d37c579440 (patch) | |
tree | f00b08a90af6e3c63cd3683d999e7f3b00c1223c /src/autocmd.c | |
parent | 4be18e77ff2d9a85d01e9d62335542755b26d5d5 (diff) |
patch 9.0.1277: cursor may move with autocmd in Visual modev9.0.1277
Problem: Cursor may move with autocmd in Visual mode.
Solution: Restore "VIsual_active" before calling check_cursor().
(closes #11939)
Diffstat (limited to 'src/autocmd.c')
-rw-r--r-- | src/autocmd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/autocmd.c b/src/autocmd.c index c18d2a15ab..a409379b61 100644 --- a/src/autocmd.c +++ b/src/autocmd.c @@ -1695,6 +1695,7 @@ win_found: globaldir = aco->globaldir; // the buffer contents may have changed + VIsual_active = aco->save_VIsual_active; check_cursor(); if (curwin->w_topline > curbuf->b_ml.ml_line_count) { @@ -1741,14 +1742,16 @@ win_found: curwin = save_curwin; curbuf = curwin->w_buffer; prevwin = win_find_by_id(aco->save_prevwin_id); + // In case the autocommand moves the cursor to a position that // does not exist in curbuf. + VIsual_active = aco->save_VIsual_active; check_cursor(); } } - check_cursor(); // just in case lines got deleted VIsual_active = aco->save_VIsual_active; + check_cursor(); // just in case lines got deleted if (VIsual_active) check_pos(curbuf, &VIsual); } |