comparison src/testdir/test_window_cmd.vim @ 32931:41482b74f548 v9.0.1772

patch 9.0.1772: Cursor may be adjusted in 'splitkeep'ed windows Commit: https://github.com/vim/vim/commit/16af913eeefb288ce968fb87e09a597413861900 Author: Luuk van Baal <luukvbaal@gmail.com> Date: Sun Aug 20 20:44:59 2023 +0200 patch 9.0.1772: Cursor may be adjusted in 'splitkeep'ed windows Problem: Cursor is adjusted in window that did not change in size by 'splitkeep'. Solution: Only check that cursor position is valid in a window that has changed in size. closes: #12509 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 20 Aug 2023 21:00:03 +0200
parents 695b50472e85
children 808cf14bad77
comparison
equal deleted inserted replaced
32930:2ff007677dba 32931:41482b74f548
1859 %bwipeout! 1859 %bwipeout!
1860 set splitbelow& 1860 set splitbelow&
1861 set splitkeep& 1861 set splitkeep&
1862 endfunc 1862 endfunc
1863 1863
1864 func Test_splitkeep_cursor()
1865 CheckScreendump
1866 let lines =<< trim END
1867 set splitkeep=screen
1868 autocmd CursorMoved * wincmd p | wincmd p
1869 call setline(1, range(1, 200))
1870 func CursorEqualize()
1871 call cursor(100, 1)
1872 wincmd =
1873 endfunc
1874 wincmd s
1875 call CursorEqualize()
1876 END
1877 call writefile(lines, 'XTestSplitkeepCallback', 'D')
1878 let buf = RunVimInTerminal('-S XTestSplitkeepCallback', #{rows: 8})
1879
1880 call VerifyScreenDump(buf, 'Test_splitkeep_cursor_1', {})
1881
1882 call term_sendkeys(buf, "j")
1883 call VerifyScreenDump(buf, 'Test_splitkeep_cursor_2', {})
1884
1885 call term_sendkeys(buf, ":set scrolloff=0\<CR>G")
1886 call VerifyScreenDump(buf, 'Test_splitkeep_cursor_3', {})
1887
1888 call StopVimInTerminal(buf)
1889 endfunc
1890
1864 func Test_splitkeep_callback() 1891 func Test_splitkeep_callback()
1865 CheckScreendump 1892 CheckScreendump
1866 let lines =<< trim END 1893 let lines =<< trim END
1867 set splitkeep=screen 1894 set splitkeep=screen
1868 call setline(1, range(&lines)) 1895 call setline(1, range(&lines))