aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/scroll_opt_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/legacy/scroll_opt_spec.lua')
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua256
1 files changed, 89 insertions, 167 deletions
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
index 8ac1141c2b..8d22c299d6 100644
--- a/test/functional/legacy/scroll_opt_spec.lua
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -23,9 +23,9 @@ describe('smoothscroll', function()
set number
]])
feed('<C-Y>')
- screen:expect({any = " 1 ^one"})
+ screen:expect({ any = ' 1 ^one' })
feed('<C-E><C-E><C-E>')
- screen:expect({any = " 2 ^two"})
+ screen:expect({ any = ' 2 ^two' })
end)
-- oldtest: Test_smoothscroll_CtrlE_CtrlY()
@@ -36,17 +36,14 @@ describe('smoothscroll', function()
:5
]])
local s1 = [[
- word word word word word word word word |
- word word word word word word word word |
+ word word word word word word word word |*2
word word word word |
line three |
long word long word long word long word |
long word long word long word |
^line |
- line |
- line |
- ~ |
- ~ |
+ line |*2
+ ~ |*2
|
]]
local s2 = [[
@@ -56,11 +53,8 @@ describe('smoothscroll', function()
long word long word long word long word |
long word long word long word |
^line |
- line |
- line |
- ~ |
- ~ |
- ~ |
+ line |*2
+ ~ |*3
|
]]
local s3 = [[
@@ -69,26 +63,17 @@ describe('smoothscroll', function()
long word long word long word long word |
long word long word long word |
^line |
- line |
- line |
- ~ |
- ~ |
- ~ |
- ~ |
+ line |*2
+ ~ |*4
|
]]
local s4 = [[
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*5
|
]]
local s5 = [[
@@ -96,13 +81,9 @@ describe('smoothscroll', function()
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]]
local s6 = [[
@@ -111,38 +92,30 @@ describe('smoothscroll', function()
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]]
local s7 = [[
- word word word word word word word word |
- word word word word word word word word |
+ word word word word word word word word |*2
word word word word |
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
- ~ |
- ~ |
+ ~ |*2
|
]]
local s8 = [[
line one |
- word word word word word word word word |
- word word word word word word word word |
+ word word word word word word word word |*2
word word word word |
line three |
long word long word long word long word |
long word long word long word |
- line |
- line |
+ line |*2
^line |
~ |
|
@@ -187,8 +160,7 @@ describe('smoothscroll', function()
ϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛ^ϛϛϛϛϛ|
ϛϛϛϛϛ |
222222222222222222222222222222222222 |
- ~ |
- ~ |
+ ~ |*2
|
]])
end)
@@ -217,9 +189,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]])
feed('<C-E>')
@@ -231,10 +201,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
feed('<C-E>')
@@ -245,11 +212,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*5
|
]])
exec('set cpo-=n')
@@ -261,10 +224,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
feed('<C-Y>')
@@ -277,9 +237,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]])
feed('<C-Y>')
@@ -293,8 +251,7 @@ describe('smoothscroll', function()
3 ^line |
4 line |
5 line |
- ~ |
- ~ |
+ ~ |*2
|
]])
exec('botright split')
@@ -351,18 +308,13 @@ describe('smoothscroll', function()
y long text very long text very long|
text very long text very long text |
1 three |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*6
--No lines in buffer-- |
]])
end)
-- oldtest: Test_smoothscroll_list()
- it("works with list mode", function()
+ it('works with list mode', function()
screen:try_resize(40, 8)
exec([[
set smoothscroll scrolloff=0
@@ -376,8 +328,7 @@ describe('smoothscroll', function()
very long text very long text very long |
text very long text- |
three |
- ~ |
- ~ |
+ ~ |*2
|
]])
exec('set listchars+=precedes:#')
@@ -387,14 +338,13 @@ describe('smoothscroll', function()
very long text very long text very long |
text very long text- |
three |
- ~ |
- ~ |
+ ~ |*2
|
]])
end)
-- oldtest: Test_smoothscroll_diff_mode()
- it("works with diff mode", function()
+ it('works with diff mode', function()
screen:try_resize(40, 8)
exec([[
let text = 'just some text here'
@@ -408,8 +358,7 @@ describe('smoothscroll', function()
]])
screen:expect([[
- ^just some text here |
- ~ |
- ~ |
+ ~ |*2
[No Name] [+] |
- just some text here |
~ |
@@ -476,7 +425,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_wrap_long_line()
- it("adjusts the cursor position in a long line", function()
+ it('adjusts the cursor position in a long line', function()
screen:try_resize(40, 6)
exec([[
call setline(1, ['one', 'two', 'Line' .. (' with lots of text'->repeat(30)) .. ' end', 'four'])
@@ -580,10 +529,7 @@ describe('smoothscroll', function()
feed('zt')
screen:expect([[
^four |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
feed('zz')
@@ -591,8 +537,7 @@ describe('smoothscroll', function()
<<<of text with lots of text with lots o|
f text with lots of text end |
^four |
- ~ |
- ~ |
+ ~ |*2
|
]])
feed('zb')
@@ -608,7 +553,9 @@ describe('smoothscroll', function()
-- This time, use a shorter long line that is barely long enough to span more
-- 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'])")
+ 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()
@@ -630,7 +577,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_one_long_line()
- it("scrolls correctly when moving the cursor", function()
+ it('scrolls correctly when moving the cursor', function()
screen:try_resize(40, 6)
exec([[
call setline(1, 'with lots of text '->repeat(7))
@@ -650,8 +597,7 @@ describe('smoothscroll', function()
<<<ts of text with lots of text with lot|
^s of text with lots of text with lots of|
text |
- ~ |
- ~ |
+ ~ |*2
|
]])
feed('0')
@@ -659,7 +605,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_long_line_showbreak()
- it("cursor is not one screen line too far down", function()
+ it('cursor is not one screen line too far down', function()
screen:try_resize(40, 6)
-- a line that spans four screen lines
exec("call setline(1, 'with lots of text in one line '->repeat(6))")
@@ -696,28 +642,23 @@ describe('smoothscroll', function()
screen:expect([[
^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
口口口口口口口口口口 |
- ~ |
- ~ |
- ~ |
+ ~ |*3
|
]])
feed('<C-E>')
screen:expect([[
<<< 口口口口口口口^口 |
- ~ |
- ~ |
- ~ |
- ~ |
+ ~ |*4
|
]])
end)
-- oldtest: Test_smoothscroll_zero_width()
- it("does not divide by zero with a narrow window", function()
+ it('does not divide by zero with a narrow window', function()
screen:try_resize(12, 2)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown},
- [2] = {foreground = Screen.colors.Blue1, bold = true},
+ [1] = { foreground = Screen.colors.Brown },
+ [2] = { foreground = Screen.colors.Blue1, bold = true },
})
exec([[
call setline(1, ['a'->repeat(100)])
@@ -739,7 +680,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_ins_lines()
- it("does not unnecessarily insert lines", function()
+ it('does not unnecessarily insert lines', function()
screen:try_resize(40, 6)
exec([=[
set wrap smoothscroll scrolloff=0 conceallevel=2 concealcursor=nc
@@ -763,7 +704,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_cursormoved_line()
- it("does not place the cursor in the command line", function()
+ it('does not place the cursor in the command line', function()
screen:try_resize(40, 6)
exec([=[
set smoothscroll
@@ -786,7 +727,7 @@ describe('smoothscroll', function()
end)
-- oldtest: Test_smoothscroll_eob()
- it("does not scroll halfway at end of buffer", function()
+ it('does not scroll halfway at end of buffer', function()
screen:try_resize(40, 10)
exec([[
set smoothscroll
@@ -795,14 +736,7 @@ describe('smoothscroll', function()
]])
-- does not scroll halfway when scrolling to end of buffer
screen:expect([[
- |
- |
- |
- |
- |
- |
- |
- |
+ |*8
^ |
|
]])
@@ -811,26 +745,20 @@ describe('smoothscroll', function()
-- cursor is not placed below window
screen:expect([[
<<<aaaaaaaaaaaaaaaaa |
- |
- |
- |
- |
- |
- |
- |
+ |*7
^ |
|
]])
end)
-- oldtest: Test_smoothscroll_incsearch()
- it("does not reset skipcol when doing incremental search on the same word", function()
+ it('does not reset skipcol when doing incremental search on the same word', function()
screen:try_resize(40, 8)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown},
- [2] = {foreground = Screen.colors.Blue1, bold = true},
- [3] = {background = Screen.colors.Yellow1},
- [4] = {reverse = true},
+ [1] = { foreground = Screen.colors.Brown },
+ [2] = { foreground = Screen.colors.Blue1, bold = true },
+ [3] = { background = Screen.colors.Yellow1 },
+ [4] = { reverse = true },
})
exec([[
set smoothscroll number scrolloff=0 incsearch
@@ -888,8 +816,8 @@ describe('smoothscroll', function()
it('scrolling multiple lines and stopping at non-zero skipcol', function()
screen:try_resize(40, 10)
screen:set_default_attr_ids({
- [0] = {foreground = Screen.colors.Blue, bold = true},
- [1] = {background = Screen.colors.Grey90},
+ [0] = { foreground = Screen.colors.Blue, bold = true },
+ [1] = { background = Screen.colors.Grey90 },
})
exec([[
setlocal cursorline scrolloff=0 smoothscroll
@@ -907,8 +835,7 @@ describe('smoothscroll', function()
aaaaaaaaaa |
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaa |
- |
- |
+ |*2
bbb |
|
]])
@@ -917,25 +844,19 @@ describe('smoothscroll', function()
{0:<<<}{1:aaaaaa^a }|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaa |
- |
- |
+ |*2
bbb |
ccc |
- {0:~ }|
- {0:~ }|
+ {0:~ }|*2
|
]])
feed('2<C-E>')
screen:expect([[
{0:<<<}{1:aaaaaa^a }|
- |
- |
+ |*2
bbb |
ccc |
- {0:~ }|
- {0:~ }|
- {0:~ }|
- {0:~ }|
+ {0:~ }|*4
|
]])
end)
@@ -944,10 +865,10 @@ describe('smoothscroll', function()
it('does not divide by zero in zero-width window', function()
screen:try_resize(40, 19)
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown}; -- LineNr
- [2] = {bold = true, foreground = Screen.colors.Blue}; -- NonText
- [3] = {bold = true, reverse = true}; -- StatusLine
- [4] = {reverse = true}; -- StatusLineNC
+ [1] = { foreground = Screen.colors.Brown }, -- LineNr
+ [2] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
+ [3] = { bold = true, reverse = true }, -- StatusLine
+ [4] = { reverse = true }, -- StatusLineNC
})
exec([[
silent normal yy
@@ -962,21 +883,7 @@ describe('smoothscroll', function()
]])
screen:expect([[
{1: }│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
- {2:@}│ |
+ {2:@}│ |*15
{2:^@}│ |
{3:< }{4:[No Name] [+] }|
|
@@ -1001,8 +908,7 @@ describe('smoothscroll', function()
line3line3line3line3line3line3line3line3|
line3line3line3line3 |
line4 |
- ~ |
- ~ |
+ ~ |*2
[No Name] [+] |
|
]])
@@ -1023,7 +929,7 @@ describe('smoothscroll', function()
assert_alive()
end)
- it("works with virt_lines above and below", function()
+ it('works with virt_lines above and below', function()
screen:try_resize(55, 7)
exec([=[
call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(3))
@@ -1096,6 +1002,22 @@ describe('smoothscroll', function()
]])
end)
+ it('works in Insert mode at bottom of window', function()
+ screen:try_resize(40, 9)
+ exec([[
+ call setline(1, repeat([repeat('A very long line ...', 10)], 5))
+ set wrap smoothscroll scrolloff=0
+ ]])
+ feed('Go123456789<CR>')
+ screen:expect([[
+ <<<ery long line ...A very long line ...|
+ A very long line ...A very long line ...|*5
+ 123456789 |
+ ^ |
+ -- INSERT -- |
+ ]])
+ end)
+
it('<<< marker shows with tabline, winbar and splits', function()
screen:try_resize(40, 12)
exec([[
@@ -1153,8 +1075,8 @@ describe('smoothscroll', function()
it('works with very long line', function()
screen:set_default_attr_ids({
- [1] = {foreground = Screen.colors.Brown},
- [2] = {foreground = Screen.colors.Blue1, bold = true},
+ [1] = { foreground = Screen.colors.Brown },
+ [2] = { foreground = Screen.colors.Blue1, bold = true },
})
exec([[
edit test/functional/fixtures/bigfile_oneline.txt