vim-patch:9.1.2001: cursor may end up in wrong window after :botright copen (#37056)

Problem:  After :botright copen and closing the quikfix window, the
          cursor ends up in the wrong window. The problem is fr_child
          always points to the first (leftmost for FR_ROW, topmost for
          FR_COL) child frame. When do :vsplit, the new window is
          created on the left, and frame_insert() updates the parent's
          fr_child to point to this new left window.
Solution: Create a snapshot before open the quickfix window and restore
          it when close it (glepnir).

closes: vim/vim#18961

b43f9ded7e

Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
zeertzjq
2025-12-21 10:41:53 +08:00
committed by GitHub
parent 69167006a4
commit f89558848b
5 changed files with 52 additions and 19 deletions

View File

@@ -6980,4 +6980,15 @@ func Test_vimgrep_dummy_buffer_keep()
%bw!
endfunc
func Test_quickfix_restore_current_win()
let curwin = win_getid()
vsplit Xb
wincmd p
botright copen
cclose
call assert_equal(curwin, win_getid())
bw! Xb
endfunc
" vim: shiftwidth=2 sts=2 expandtab