diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-12 07:24:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-12 07:24:13 +0800 |
commit | d6e898b44fbd6b18b3ca23f780ffaedc343961f1 (patch) | |
tree | c72abf5286e3c89e6889c89cf3500e9008bda678 /test/functional | |
parent | 30a0299bc6d1ceedd04d897cf56b298dd3ded0cd (diff) | |
parent | 6f41eaa2b5abd5c252428ba278a9fcc356e48c1d (diff) | |
download | rneovim-d6e898b44fbd6b18b3ca23f780ffaedc343961f1.tar.gz rneovim-d6e898b44fbd6b18b3ca23f780ffaedc343961f1.tar.bz2 rneovim-d6e898b44fbd6b18b3ca23f780ffaedc343961f1.zip |
Merge pull request #23558 from luukvbaal/smoothscroll
vim-patch:9.0.{1530,1533,1542,1543}
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/legacy/display_spec.lua | 73 | ||||
-rw-r--r-- | test/functional/legacy/normal_spec.lua | 41 | ||||
-rw-r--r-- | test/functional/legacy/scroll_opt_spec.lua | 32 |
3 files changed, 121 insertions, 25 deletions
diff --git a/test/functional/legacy/display_spec.lua b/test/functional/legacy/display_spec.lua index f1cd8d1aac..f59eac7674 100644 --- a/test/functional/legacy/display_spec.lua +++ b/test/functional/legacy/display_spec.lua @@ -196,17 +196,17 @@ describe('display', function() end) -- oldtest: Test_display_long_lastline() - it('display "lastline" shows correct text when end of wrapped line is deleted', function() + it('"lastline" shows correct text when end of wrapped line is deleted', function() local screen = Screen.new(35, 14) screen:attach() exec([[ - set display=lastline scrolloff=5 + set display=lastline smoothscroll scrolloff=0 call setline(1, [ - \'aaaaa'->repeat(100), + \'aaaaa'->repeat(500), \'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7) \]) ]]) - feed('482|') + feed('736|') screen:expect([[ <<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| @@ -219,10 +219,11 @@ describe('display', function() aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - aaaaaaaaaaaaaaaaaaaaaaaaaa^aaaaaaaaa| - aaaaaaaaaa | + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + ^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| | ]]) + -- The correct part of the last line is moved into view. feed('D') screen:expect([[ <<<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| @@ -236,9 +237,67 @@ describe('display', function() aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| - aaaaaaaaaaaaaaaaaaaaaaaaa^a | + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa^a| bbbbb bbbbb bbbbb bbbbb bbbbb bb@@@| | ]]) + -- "w_skipcol" does not change because the topline is still long enough + -- to maintain the current skipcol. + feed('g04l11gkD') + screen:expect([[ + <<<^a | + bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb| + bbbbb ccccc ccccc ccccc ccccc cccc| + c ccccc ccccc ddddd ddddd ddddd ddd| + dd ddddd ddddd ddddd | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + | + ]]) + -- "w_skipcol" is reset to bring the entire topline into view because + -- the line length is now smaller than the current skipcol + marker. + feed('x') + screen:expect([[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + aa^a | + bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb| + bbbbb ccccc ccccc ccccc ccccc cccc| + c ccccc ccccc ddddd ddddd ddddd @@@| + | + ]]) + end) + + -- oldtest: Test_display_cursor_long_line() + it("correctly shows line that doesn't fit in the window", function() + local screen = Screen.new(75, 8) + screen:attach() + exec([[ + call setline(1, ['a', 'bbbbb '->repeat(100), 'c']) + norm $j + ]]) + screen:expect([[ + <<<bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb | + bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbb| + bb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb | + bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbb| + bb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb | + bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbb| + bb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb bbbbb^ | + | + ]]) end) end) diff --git a/test/functional/legacy/normal_spec.lua b/test/functional/legacy/normal_spec.lua new file mode 100644 index 0000000000..ba875460f5 --- /dev/null +++ b/test/functional/legacy/normal_spec.lua @@ -0,0 +1,41 @@ +local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') +local clear = helpers.clear +local exec = helpers.exec + +before_each(clear) + +describe('normal', function() + -- oldtest: Test_normal_j_below_botline() + it([["j" does not skip lines when scrolling below botline and 'foldmethod' is not "manual"]], function() + local screen = Screen.new(40, 19) + screen:attach() + screen:set_default_attr_ids({{foreground = Screen.colors.Brown}}) + exec([[ + set number foldmethod=diff scrolloff=0 + call setline(1, map(range(1, 9), 'repeat(v:val, 200)')) + norm Lj + ]]) + screen:expect([[ + {1: 2 }222222222222222222222222222222222222| + {1: }222222222222222222222222222222222222| + {1: }222222222222222222222222222222222222| + {1: }222222222222222222222222222222222222| + {1: }222222222222222222222222222222222222| + {1: }22222222222222222222 | + {1: 3 }333333333333333333333333333333333333| + {1: }333333333333333333333333333333333333| + {1: }333333333333333333333333333333333333| + {1: }333333333333333333333333333333333333| + {1: }333333333333333333333333333333333333| + {1: }33333333333333333333 | + {1: 4 }^444444444444444444444444444444444444| + {1: }444444444444444444444444444444444444| + {1: }444444444444444444444444444444444444| + {1: }444444444444444444444444444444444444| + {1: }444444444444444444444444444444444444| + {1: }44444444444444444444 | + | + ]]) + end) +end) diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua index 869763be3c..838ada4006 100644 --- a/test/functional/legacy/scroll_opt_spec.lua +++ b/test/functional/legacy/scroll_opt_spec.lua @@ -556,13 +556,13 @@ describe('smoothscroll', function() | ]]) -- Test zt/zz/zb that they work properly when a long line is above it - feed('zb') + feed('zt') screen:expect([[ - <<<th lots of text with lots of text wit| - h lots of text with lots of text with lo| - ts of text with lots of text with lots o| - f text with lots of text end | ^four | + ~ | + ~ | + ~ | + ~ | | ]]) feed('zz') @@ -574,13 +574,13 @@ describe('smoothscroll', function() ~ | | ]]) - feed('zt') + feed('zb') screen:expect([[ + <<<th lots of text with lots of text wit| + h lots of text with lots of text with lo| + ts of text with lots of text with lots o| + f text with lots of text end | ^four | - ~ | - ~ | - ~ | - ~ | | ]]) -- Repeat the step and move the cursor down again. @@ -588,15 +588,11 @@ describe('smoothscroll', function() -- than one window. Note that the cursor is at the bottom this time because -- Vim prefers to do so if we are scrolling a few lines only. exec("call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])") + -- Currently visible lines were replaced, test that the lines and cursor + -- are correctly displayed. + screen:expect_unchanged() feed('3Gztj') - screen:expect([[ - <<<th lots of text with lots of text wit| - h lots of text with lots of text with lo| - ts of text with lots of text with lots o| - f text with lots of text end | - ^four | - | - ]]) + screen:expect_unchanged() -- Repeat the step but this time start it when the line is smooth-scrolled by -- one line. This tests that the offset calculation is still correct and -- still end up scrolling down to the next line with cursor at bottom of |