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/old | |
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/old')
-rw-r--r-- | test/old/testdir/test_display.vim | 36 | ||||
-rw-r--r-- | test/old/testdir/test_normal.vim | 18 | ||||
-rw-r--r-- | test/old/testdir/test_scroll_opt.vim | 11 |
3 files changed, 58 insertions, 7 deletions
diff --git a/test/old/testdir/test_display.vim b/test/old/testdir/test_display.vim index f27a8362a9..a2b40521d9 100644 --- a/test/old/testdir/test_display.vim +++ b/test/old/testdir/test_display.vim @@ -482,9 +482,9 @@ func Test_display_long_lastline() CheckScreendump let lines =<< trim END - set display=lastline + set display=lastline smoothscroll scrolloff=0 call setline(1, [ - \'aaaaa'->repeat(100), + \'aaaaa'->repeat(150), \'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7) \]) END @@ -492,11 +492,41 @@ func Test_display_long_lastline() call writefile(lines, 'XdispLongline', 'D') let buf = RunVimInTerminal('-S XdispLongline', #{rows: 14, cols: 35}) - call term_sendkeys(buf, "482|") + call term_sendkeys(buf, "736|") call VerifyScreenDump(buf, 'Test_display_long_line_1', {}) + + " The correct part of the last line is moved into view. call term_sendkeys(buf, "D") call VerifyScreenDump(buf, 'Test_display_long_line_2', {}) + " "w_skipcol" does not change because the topline is still long enough + " to maintain the current skipcol. + call term_sendkeys(buf, "g04l11gkD") + call VerifyScreenDump(buf, 'Test_display_long_line_3', {}) + + " "w_skipcol" is reset to bring the entire topline into view because + " the line length is now smaller than the current skipcol + marker. + call term_sendkeys(buf, "x") + call VerifyScreenDump(buf, 'Test_display_long_line_4', {}) + + call StopVimInTerminal(buf) +endfunc + +" Moving the cursor to a line that doesn't fit in the window should show +" correctly. +func Test_display_cursor_long_line() + CheckScreendump + + let lines =<< trim END + call setline(1, ['a', 'bbbbb '->repeat(100), '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 StopVimInTerminal(buf) endfunc diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim index a854c9538f..23baebb78c 100644 --- a/test/old/testdir/test_normal.vim +++ b/test/old/testdir/test_normal.vim @@ -3993,4 +3993,22 @@ func Test_mouse_shape_after_cancelling_gr() call delete('Xmouseshapes') endfunc +" Test that "j" does not skip lines when scrolling below botline and +" 'foldmethod' is not "manual". +func Test_normal_j_below_botline() + CheckScreendump + + let lines =<< trim END + set number foldmethod=diff scrolloff=0 + call setline(1, map(range(1, 9), 'repeat(v:val, 200)')) + norm Lj + END + call writefile(lines, 'XNormalJBelowBotline', 'D') + let buf = RunVimInTerminal('-S XNormalJBelowBotline', #{rows: 19, cols: 40}) + + call VerifyScreenDump(buf, 'Test_normal_j_below_botline', {}) + + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 4edf9cc6f5..6f3d12679e 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -323,11 +323,11 @@ func Test_smoothscroll_wrap_long_line() call VerifyScreenDump(buf, 'Test_smooth_long_10', {}) " Test zt/zz/zb that they work properly when a long line is above it - call term_sendkeys(buf, "zb") + call term_sendkeys(buf, "zt") call VerifyScreenDump(buf, 'Test_smooth_long_11', {}) call term_sendkeys(buf, "zz") call VerifyScreenDump(buf, 'Test_smooth_long_12', {}) - call term_sendkeys(buf, "zt") + call term_sendkeys(buf, "zb") call VerifyScreenDump(buf, 'Test_smooth_long_13', {}) " Repeat the step and move the cursor down again. @@ -335,9 +335,12 @@ func Test_smoothscroll_wrap_long_line() " 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. call term_sendkeys(buf, ":call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(10)) .. ' end', 'four'])\<CR>") + " Currently visible lines were replaced, test that the lines and cursor + " are correctly displayed. + call VerifyScreenDump(buf, 'Test_smooth_long_14', {}) call term_sendkeys(buf, "3Gzt") call term_sendkeys(buf, "j") - call VerifyScreenDump(buf, 'Test_smooth_long_14', {}) + call VerifyScreenDump(buf, 'Test_smooth_long_15', {}) " 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 @@ -345,7 +348,7 @@ func Test_smoothscroll_wrap_long_line() " screen. call term_sendkeys(buf, "3Gzt") call term_sendkeys(buf, "\<C-E>j") - call VerifyScreenDump(buf, 'Test_smooth_long_15', {}) + call VerifyScreenDump(buf, 'Test_smooth_long_16', {}) call StopVimInTerminal(buf) endfunc |