From 8e4a4629cab3377ba6fd5e291cf5f17fb4ff8a5c Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 16:54:23 +0200 Subject: vim-patch:9.0.0671: negative topline using CTRL-Y with 'smoothscroll' and 'diff' Problem: Negative topline using CTRL-Y with 'smoothscroll' and 'diff'. (Ernie Rael) Solution: Only use 'smoothscroll' when 'wrap' is set. https://github.com/vim/vim/commit/1a58e1d97cfc72e501cbf63ad75f46f1bb4c8da2 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 29 +++++++++++++++++++++++++++++ test/old/testdir/test_scroll_opt.vim | 26 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 8d2eade1a8..90417d93f3 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -272,4 +272,33 @@ describe('smoothscroll', function() | ]]) end) + + -- oldtest: Test_smoothscroll_diff_mode() + it("works with diff mode", function() + screen:try_resize(40, 8) + exec([[ + let text = 'just some text here' + call setline(1, text) + set smoothscroll + diffthis + new + call setline(1, text) + set smoothscroll + diffthis + ]]) + screen:expect([[ + - ^just some text here | + ~ | + ~ | + [No Name] [+] | + - just some text here | + ~ | + [No Name] [+] | + | + ]]) + feed('') + screen:expect_unchanged() + feed('') + screen:expect_unchanged() + end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index f574286b09..53768de6fa 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -158,6 +158,32 @@ func Test_smoothscroll_number() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_diff_mode() + CheckScreendump + + let lines =<< trim END + vim9script + var text = 'just some text here' + setline(1, text) + set smoothscroll + diffthis + new + setline(1, text) + set smoothscroll + diffthis + END + call writefile(lines, 'XSmoothDiff', 'D') + let buf = RunVimInTerminal('-S XSmoothDiff', #{rows: 8}) + + call VerifyScreenDump(buf, 'Test_smooth_diff_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_diff_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smooth_diff_1', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit