diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-12-02 10:56:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-02 10:56:40 +0800 |
commit | c45d1e32a92f5027fe12038b856509efe5c158fb (patch) | |
tree | 492b01ed1fed314cf279bb84857db1527be91d19 /src/nvim/window.c | |
parent | 387c5ba3de356ea5c5f6fe71465440abd8563d8e (diff) | |
parent | 9d7544ac4cd553c9b7c8b41926b7292c5ee85943 (diff) | |
download | rneovim-c45d1e32a92f5027fe12038b856509efe5c158fb.tar.gz rneovim-c45d1e32a92f5027fe12038b856509efe5c158fb.tar.bz2 rneovim-c45d1e32a92f5027fe12038b856509efe5c158fb.zip |
Merge pull request #26358 from zeertzjq/vim-9.0.2140
vim-patch:9.0.{2140,2141,2142,2143}
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 7728efde33..ef1ef89d95 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -4470,11 +4470,12 @@ void tabpage_move(int nr) redraw_tabline = true; } -// Go to another window. -// When jumping to another buffer, stop Visual mode. Do this before -// changing windows so we can yank the selection into the '*' register. -// When jumping to another window on the same buffer, adjust its cursor -// position to keep the same Visual area. +/// Go to another window. +/// When jumping to another buffer, stop Visual mode. Do this before +/// changing windows so we can yank the selection into the '*' register. +/// (note: this may trigger ModeChanged autocommand!) +/// When jumping to another window on the same buffer, adjust its cursor +/// position to keep the same Visual area. void win_goto(win_T *wp) { win_T *owp = curwin; @@ -4485,11 +4486,17 @@ void win_goto(win_T *wp) } if (wp->w_buffer != curbuf) { + // careful: triggers ModeChanged autocommand reset_VIsual_and_resel(); } else if (VIsual_active) { wp->w_cursor = curwin->w_cursor; } + // autocommand may have made wp invalid + if (!win_valid(wp)) { + return; + } + win_enter(wp, true); // Conceal cursor line in previous window, unconceal in current window. |