From 44fc2a6d7e642d5b02c2fc7de11f478401a51bb2 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Tue, 9 May 2023 01:44:31 +0200 Subject: vim-patch:9.0.1525: 'smoothscroll' does not always work properly (#23544) Problem: 'smoothscroll' does not always work properly. Solution: Do not reset w_skipcol after it was intentionally set. (Luuk van Baal, closes vim/vim#12360, closes vim/vim#12199, closes vim/vim#12323) https://github.com/vim/vim/commit/3ce8c389155fc1257082cdb0cef7801b49f6aaf9 --- test/functional/legacy/scroll_opt_spec.lua | 69 ++++++++++++++++++++++++++++-- test/old/testdir/test_scroll_opt.vim | 43 +++++++++++++++++++ 2 files changed, 108 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index c3c99b506b..869763be3c 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -548,11 +548,11 @@ describe('smoothscroll', function() exec('set scrolloff=0') feed('0j') screen:expect([[ - <<repeat(&lines * &columns), + \(('_')->repeat(&columns - 2) .. 'xxx')->repeat(2) + \]) + autocmd CursorMoved * eval [line('w0'), line('w$')] + call search('xxx') + ]=]) + screen:expect([[ + <<<_____________________________________| + ________________________________________| + ______________________________________^xx| + x______________________________________x| + xx | + | + ]]) + end) + + -- oldtest: Test_smoothscroll_eob() + it("does not scroll halfway at end of buffer", function() + screen:try_resize(40, 10) + exec([[ + set smoothscroll + call setline(1, ['']->repeat(100)) + norm G + ]]) + -- does not scroll halfway when scrolling to end of buffer + screen:expect([[ + | + | + | + | + | + | + | + | + ^ | + | + ]]) + exec("call setline(92, 'a'->repeat(100))") + feed('G') + -- cursor is not placed below window + screen:expect([[ + <<repeat(&lines * &columns), + \(('_')->repeat(&columns - 2) .. 'xxx')->repeat(2) + \]) + autocmd CursorMoved * eval [line('w0'), line('w$')] + call search('xxx') + END + call writefile(lines, 'XSmoothCursorMovedLine', 'D') + let buf = RunVimInTerminal('-S XSmoothCursorMovedLine', #{rows: 6}) + + call VerifyScreenDump(buf, 'Test_smooth_cursormoved_line', {}) + + call StopVimInTerminal(buf) +endfunc + +func Test_smoothscroll_eob() + CheckScreendump + + let lines =<< trim END + set smoothscroll + call setline(1, ['']->repeat(100)) + norm G + END + call writefile(lines, 'XSmoothEob', 'D') + let buf = RunVimInTerminal('-S XSmoothEob', #{rows: 10}) + + " does not scroll halfway when scrolling to end of buffer + call VerifyScreenDump(buf, 'Test_smooth_eob_1', {}) + + " cursor is not placed below window + call term_sendkeys(buf, ":call setline(92, 'a'->repeat(100))\\G") + call VerifyScreenDump(buf, 'Test_smooth_eob_2', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit