From d6050e9bda7f8b080c577100ae94e017dc146c88 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 26 Apr 2023 04:32:50 +0200 Subject: vim-patch:9.0.0646: with 'smoothscroll' CTRL-E is wrong when 'foldmethod' set Problem: with 'smoothscroll' set CTRL-E does not work properly when 'foldmethod' is set to "indent". (Yee Cheng Chin) Solution: Merge the code for scroling with folds and 'smoothscroll'. (closes vim/vim#11262) https://github.com/vim/vim/commit/6b2d4ff7148e0b416ba745d20d061e6f7bb53ee7 Co-authored-by: Bram Moolenaar --- test/functional/legacy/scroll_opt_spec.lua | 80 ++++++++++++++++++++++++------ test/old/testdir/test_scroll_opt.vim | 15 ++++++ 2 files changed, 81 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 14dbe0caf9..20976089e2 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -31,11 +31,10 @@ describe('smoothscroll', function() it('works with and ', function() exec([[ call setline(1, [ 'line one', 'word '->repeat(20), 'line three', 'long word '->repeat(7), 'line', 'line', 'line', ]) - set smoothscroll + set smoothscroll scrolloff=5 :5 ]]) - local s0 = [[ - line one | + local s1 = [[ word word word word word word word word | word word word word word word word word | word word word word | @@ -45,11 +44,11 @@ describe('smoothscroll', function() ^line | line | line | + ~ | ~ | | ]] - local s1 = [[ - word word word word word word word word | + local s2 = [[ word word word word word word word word | word word word word | line three | @@ -59,11 +58,11 @@ describe('smoothscroll', function() line | line | ~ | + ~ | ~ | | ]] - local s2 = [[ - word word word word word word word word | + local s3 = [[ word word word word | line three | long word long word long word long word | @@ -73,37 +72,80 @@ describe('smoothscroll', function() line | ~ | ~ | + ~ | ~ | | ]] - local s3 = [[ - word word word word | + local s4 = [[ line three | long word long word long word long word | long word long word long word | - ^line | line | line | + ^line | + ~ | ~ | ~ | ~ | ~ | | ]] - local s4 = [[ + local s5 = [[ + word word word word | line three | long word long word long word long word | long word long word long word | + line | + line | ^line | + ~ | + ~ | + ~ | + ~ | + | + ]] + local s6 = [[ + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | line | line | + ^line | ~ | ~ | ~ | + | + ]] + local s7 = [[ + word word word word word word word word | + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | + line | + line | + ^line | ~ | ~ | | ]] + local s8 = [[ + line one | + word word word word word word word word | + word word word word word word word word | + word word word word | + line three | + long word long word long word long word | + long word long word long word | + line | + line | + ^line | + ~ | + | + ]] feed('') screen:expect(s1) feed('') @@ -113,12 +155,22 @@ describe('smoothscroll', function() feed('') screen:expect(s4) feed('') - screen:expect(s3) + screen:expect(s5) feed('') - screen:expect(s2) + screen:expect(s6) feed('') + screen:expect(s7) + feed('') + screen:expect(s8) + exec('set foldmethod=indent') + -- move the cursor so we can reuse the same dumps + feed('5G') screen:expect(s1) + feed('') + screen:expect(s2) + feed('7G') + screen:expect(s7) feed('') - screen:expect(s0) + screen:expect(s8) end) end) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index ed3ffd83e7..c1f6c66642 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -105,6 +105,21 @@ func Test_smoothscroll_CtrlE_CtrlY() call term_sendkeys(buf, "\") call VerifyScreenDump(buf, 'Test_smoothscroll_8', {}) + if has('folding') + call term_sendkeys(buf, ":set foldmethod=indent\") + " move the cursor so we can reuse the same dumps + call term_sendkeys(buf, "5G") + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_1', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_2', {}) + call term_sendkeys(buf, "7G") + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_7', {}) + call term_sendkeys(buf, "\") + call VerifyScreenDump(buf, 'Test_smoothscroll_8', {}) + endif + call StopVimInTerminal(buf) endfunc -- cgit