mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test(normal): port legacy normal test for page scrolling (#28100)
This commit is contained in:
parent
f29c41d665
commit
3d554b755b
@ -2,16 +2,22 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local exec = helpers.exec
|
local exec = helpers.exec
|
||||||
|
local feed = helpers.feed
|
||||||
before_each(clear)
|
local api = helpers.api
|
||||||
|
local eq = helpers.eq
|
||||||
|
local fn = helpers.fn
|
||||||
|
|
||||||
describe('normal', function()
|
describe('normal', function()
|
||||||
-- oldtest: Test_normal_j_below_botline()
|
local screen
|
||||||
it(
|
|
||||||
[["j" does not skip lines when scrolling below botline and 'foldmethod' is not "manual"]],
|
before_each(function()
|
||||||
function()
|
clear()
|
||||||
local screen = Screen.new(40, 19)
|
screen = Screen.new(40, 19)
|
||||||
screen:attach()
|
screen:attach()
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- oldtest: Test_normal_j_below_botline()
|
||||||
|
it([[no skipped lines with "j" scrolling below botline and 'foldmethod' not "manual"]], function()
|
||||||
exec([[
|
exec([[
|
||||||
set number foldmethod=diff scrolloff=0
|
set number foldmethod=diff scrolloff=0
|
||||||
call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
|
call setline(1, map(range(1, 9), 'repeat(v:val, 200)'))
|
||||||
@ -29,6 +35,71 @@ describe('normal', function()
|
|||||||
{8: }44444444444444444444 |
|
{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 |*8
|
||||||
|
^foobar one two three |
|
||||||
|
{2:---} |
|
||||||
|
{1:~ }|*8
|
||||||
|
|
|
||||||
|
]],
|
||||||
|
})
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user