aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2023-04-27 04:54:50 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2023-05-02 13:11:46 +0200
commitf3b44cf23d9c240471826e4f35555ee85ded1e5b (patch)
tree4ffc9f9a95ae1147f798f4b734a9d1d1d2771de3 /test
parente9b1df21bc9c051fe46578772c45c5bdadaf1e5c (diff)
downloadrneovim-f3b44cf23d9c240471826e4f35555ee85ded1e5b.tar.gz
rneovim-f3b44cf23d9c240471826e4f35555ee85ded1e5b.tar.bz2
rneovim-f3b44cf23d9c240471826e4f35555ee85ded1e5b.zip
vim-patch:9.0.0652: 'smoothscroll' not tested with 'number' and "n" in 'cpo'
Problem: 'smoothscroll' not tested with 'number' and "n" in 'cpo'. Solution: Add tests, fix uncovered problem. https://github.com/vim/vim/commit/b6aab8f44beb8c5d99393abdc2c9faab085c72aa Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua99
-rw-r--r--test/functional/ui/highlight_spec.lua2
-rw-r--r--test/functional/ui/popupmenu_spec.lua2
-rw-r--r--test/old/testdir/test_scroll_opt.vim35
4 files changed, 136 insertions, 2 deletions
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
index ddbeca1a30..8d2eade1a8 100644
--- a/test/functional/legacy/scroll_opt_spec.lua
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -173,4 +173,103 @@ describe('smoothscroll', function()
feed('<C-Y>')
screen:expect(s8)
end)
+
+ -- oldtest: Test_smoothscroll_number()
+ it("works 'number' and 'cpo'+=n", function()
+ exec([[
+ call setline(1, [ 'one ' .. 'word '->repeat(20), 'two ' .. 'long word '->repeat(7), 'line', 'line', 'line', ])
+ set smoothscroll scrolloff=5
+ set number cpo+=n
+ :3
+ ]])
+ screen:expect([[
+ 1 one word word word word word word wo|
+ rd word word word word word word word wo|
+ rd word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long word |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ <<<word word word word word word word wo|
+ rd word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long word |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ <<<word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long word |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ exec('set cpo-=n')
+ screen:expect([[
+ <<< d word word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long wor|
+ d |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-Y>')
+ screen:expect([[
+ <<< rd word word word word word word wor|
+ d word word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long wor|
+ d |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
+ feed('<C-Y>')
+ screen:expect([[
+ 1 one word word word word word word wo|
+ rd word word word word word word wor|
+ d word word word word word word |
+ 2 two long word long word long word lo|
+ ng word long word long word long wor|
+ d |
+ 3 ^line |
+ 4 line |
+ 5 line |
+ ~ |
+ ~ |
+ |
+ ]])
+ end)
end)
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 89b503141b..01895003ae 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -704,7 +704,7 @@ describe("'listchars' highlight", function()
feed_command('set listchars=eol:¬,precedes:< list')
feed('90ia<esc>')
screen:expect([[
- {0:<}aaaaaaaaaaaaaaaaaaa|
+ {0:<<<}aaaaaaaaaaaaaaaaa|
aaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaaaaaaaaaaaa|
aaaaaaaaa^a{0:¬} |
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua
index 0b71e12b6f..6c26c8ea39 100644
--- a/test/functional/ui/popupmenu_spec.lua
+++ b/test/functional/ui/popupmenu_spec.lua
@@ -2396,7 +2396,7 @@ describe('builtin popupmenu', function()
-- can't draw the pum, but check we don't crash
screen:try_resize(12,2)
screen:expect([[
- text^ |
+ {1:<<<}t^ |
{2:-- INSERT -} |
]])
diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim
index c1f6c66642..f574286b09 100644
--- a/test/old/testdir/test_scroll_opt.vim
+++ b/test/old/testdir/test_scroll_opt.vim
@@ -123,6 +123,41 @@ func Test_smoothscroll_CtrlE_CtrlY()
call StopVimInTerminal(buf)
endfunc
+func Test_smoothscroll_number()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ setline(1, [
+ 'one ' .. 'word '->repeat(20),
+ 'two ' .. 'long word '->repeat(7),
+ 'line',
+ 'line',
+ 'line',
+ ])
+ set smoothscroll
+ set number cpo+=n
+ :3
+ END
+ call writefile(lines, 'XSmoothNumber', 'D')
+ let buf = RunVimInTerminal('-S XSmoothNumber', #{rows: 12, cols: 40})
+
+ call VerifyScreenDump(buf, 'Test_smooth_number_1', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_2', {})
+ call term_sendkeys(buf, "\<C-E>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_3', {})
+
+ call term_sendkeys(buf, ":set cpo-=n\<CR>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_4', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_5', {})
+ call term_sendkeys(buf, "\<C-Y>")
+ call VerifyScreenDump(buf, 'Test_smooth_number_6', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab