From 5887ecab6ddd294f43ff3f2372149ce8c5f8dc7f Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 16 May 2023 01:56:06 +0200 Subject: vim-patch:9.0.1561: display wrong when moving cursor to above the top line (#23644) Problem: Display wrong when moving cursor to above the top line and 'smoothscroll' is set. Solution: Call adjust_skipcol() in more places and make it work better. (Luuk van Baal, closes vim/vim#12395) https://github.com/vim/vim/commit/798fa76dbf737f855e47b10bf326453866b429ab --- test/functional/legacy/display_spec.lua | 55 ++++++++++++++++++++++++++++----- test/old/testdir/test_display.vim | 19 ++++++++++-- test/old/testdir/test_scroll_opt.vim | 2 +- 3 files changed, 65 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua index feb2662100..482b88eae8 100644 --- a/test/functional/legacy/display_spec.lua +++ b/test/functional/legacy/display_spec.lua @@ -286,17 +286,56 @@ describe('display', function() local screen = Screen.new(75, 8) screen:attach() exec([[ - call setline(1, ['a', 'bbbbb '->repeat(100), 'c']) + call setline(1, ['a', 'b ' .. 'bbbbb'->repeat(150), 'c']) norm $j ]]) screen:expect([[ - <<repeat(100), 'c']) + call setline(1, ['a', 'b ' .. 'bbbbb'->repeat(150), 'c']) norm $j END call writefile(lines, 'XdispCursorLongline', 'D') let buf = RunVimInTerminal('-S XdispCursorLongline', #{rows: 8}) - call VerifyScreenDump(buf, 'Test_display_cursor_long_line', {}) + call VerifyScreenDump(buf, 'Test_display_cursor_long_line_1', {}) + + " FIXME: moving the cursor above the topline does not set w_skipcol + " correctly with cpo+=n and zero scrolloff (curs_columns() extra == 1). + call term_sendkeys(buf, ":set number cpo+=n scrolloff=0\") + call term_sendkeys(buf, '$0') + call VerifyScreenDump(buf, 'Test_display_cursor_long_line_2', {}) + + " Going to the start of the line with "b" did not set w_skipcol correctly + " with 'smoothscroll'. + call term_sendkeys(buf, ":set smoothscroll\") + call term_sendkeys(buf, '$b') + call VerifyScreenDump(buf, 'Test_display_cursor_long_line_3', {}) + " Same for "ge". + call term_sendkeys(buf, '$ge') + call VerifyScreenDump(buf, 'Test_display_cursor_long_line_4', {}) call StopVimInTerminal(buf) endfunc diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 13ef4b76df..74c2de81aa 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -502,7 +502,7 @@ func Test_smoothscroll_cursor_position() " regardless of number and cpo-=n. setl number list listchars=precedes:< cpo-=n call s:check_col_calc(5, 1, 1) - exe "normal 2|\" + exe "normal 3|\h" call s:check_col_calc(6, 1, 18) norm h call s:check_col_calc(5, 2, 17) -- cgit