aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/normal_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-05-24 19:18:11 +0000
commitff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch)
tree729bbcb92231538fa61dab6c3d890b025484b7f5 /test/functional/legacy/normal_spec.lua
parent376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff)
parent28c04948a1c887a1cc0cb64de79fa32631700466 (diff)
downloadrneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2
rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/legacy/normal_spec.lua')
-rw-r--r--test/functional/legacy/normal_spec.lua117
1 files changed, 94 insertions, 23 deletions
diff --git a/test/functional/legacy/normal_spec.lua b/test/functional/legacy/normal_spec.lua
index 1dddeed033..5158ca3009 100644
--- a/test/functional/legacy/normal_spec.lua
+++ b/test/functional/legacy/normal_spec.lua
@@ -1,35 +1,106 @@
-local helpers = require('test.functional.helpers')(after_each)
+local t = require('test.testutil')
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = helpers.clear
-local exec = helpers.exec
-before_each(clear)
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
+local api = n.api
+local eq = t.eq
+local fn = n.fn
describe('normal', function()
+ local screen
+
+ before_each(function()
+ clear()
+ screen = Screen.new(40, 19)
+ screen:attach()
+ end)
+
-- 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([[
+ it([[no skipped lines with "j" scrolling below botline and 'foldmethod' not "manual"]], function()
+ 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|*4
- {1: }22222222222222222222 |
- {1: 3 }333333333333333333333333333333333333|
- {1: }333333333333333333333333333333333333|*4
- {1: }33333333333333333333 |
- {1: 4 }^444444444444444444444444444444444444|
- {1: }444444444444444444444444444444444444|*4
- {1: }44444444444444444444 |
+ screen:expect([[
+ {8: 2 }222222222222222222222222222222222222|
+ {8: }222222222222222222222222222222222222|*4
+ {8: }22222222222222222222 |
+ {8: 3 }333333333333333333333333333333333333|
+ {8: }333333333333333333333333333333333333|*4
+ {8: }33333333333333333333 |
+ {8: 4 }^444444444444444444444444444444444444|
+ {8: }444444444444444444444444444444444444|*4
+ {8: }44444444444444444444 |
|
]])
- end
- )
+ end)
+
+ -- oldtest: Test_single_line_scroll()
+ it('(Half)-page scroll up or down reveals virtual lines #19605, #27967', function()
+ fn.setline(1, 'foobar one two three')
+ exec('set smoothscroll')
+ local ns = api.nvim_create_namespace('')
+ api.nvim_buf_set_extmark(0, ns, 0, 0, {
+ virt_lines = { { { '---', 'IncSearch' } } },
+ virt_lines_above = true,
+ })
+ -- Nvim: not actually necessary to scroll down to hide the virtual line.
+ -- Check topfill instead of skipcol and show the screen state.
+ feed('<C-E>')
+ eq(0, fn.winsaveview().topfill)
+ local s1 = [[
+ ^foobar one two three |
+ {1:~ }|*17
+ |
+ ]]
+ screen:expect(s1)
+ feed('<C-B>')
+ eq(1, fn.winsaveview().topfill)
+ local s2 = [[
+ {2:---} |
+ ^foobar one two three |
+ {1:~ }|*16
+ |
+ ]]
+ screen:expect(s2)
+ feed('<C-E>')
+ eq(0, fn.winsaveview().topfill)
+ screen:expect(s1)
+ feed('<C-U>')
+ eq(1, fn.winsaveview().topfill)
+ screen:expect(s2)
+
+ -- Nvim: also test virt_lines below the last line
+ feed('yy100pG<C-L>')
+ api.nvim_buf_set_extmark(0, ns, 100, 0, { virt_lines = { { { '---', 'IncSearch' } } } })
+ screen:expect({
+ grid = [[
+ foobar one two three |*17
+ ^foobar one two three |
+ |
+ ]],
+ })
+ feed('<C-F>')
+ screen:expect({
+ grid = [[
+ ^foobar one two three |
+ {2:---} |
+ {1:~ }|*16
+ |
+ ]],
+ })
+ feed('ggG<C-D>')
+ screen:expect({
+ grid = [[
+ foobar one two three |*16
+ ^foobar one two three |
+ {2:---} |
+ |
+ ]],
+ })
+ end)
end)