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.lua726
1 files changed, 449 insertions, 277 deletions
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
index 8d22c299d6..97578067d5 100644
--- a/test/functional/legacy/scroll_opt_spec.lua
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -1,9 +1,10 @@
-local helpers = require('test.functional.helpers')(after_each)
+local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
-local clear = helpers.clear
-local exec = helpers.exec
-local feed = helpers.feed
-local assert_alive = helpers.assert_alive
+
+local clear = n.clear
+local exec = n.exec
+local feed = n.feed
+local assert_alive = n.assert_alive
before_each(clear)
@@ -23,9 +24,9 @@ describe('smoothscroll', function()
set number
]])
feed('<C-Y>')
- screen:expect({ any = ' 1 ^one' })
+ screen:expect({ any = '{8: 1 }^one' })
feed('<C-E><C-E><C-E>')
- screen:expect({ any = ' 2 ^two' })
+ screen:expect({ any = '{8: 2 }^two' })
end)
-- oldtest: Test_smoothscroll_CtrlE_CtrlY()
@@ -43,28 +44,28 @@ describe('smoothscroll', function()
long word long word long word |
^line |
line |*2
- ~ |*2
+ {1:~ }|*2
|
]]
local s2 = [[
- <<<d word word word word word word word |
+ {1:<<<}d word word word word word word word |
word word word word |
line three |
long word long word long word long word |
long word long word long word |
^line |
line |*2
- ~ |*3
+ {1:~ }|*3
|
]]
local s3 = [[
- <<<d word word word |
+ {1:<<<}d word word word |
line three |
long word long word long word long word |
long word long word long word |
^line |
line |*2
- ~ |*4
+ {1:~ }|*4
|
]]
local s4 = [[
@@ -73,28 +74,28 @@ describe('smoothscroll', function()
long word long word long word |
line |*2
^line |
- ~ |*5
+ {1:~ }|*5
|
]]
local s5 = [[
- <<<d word word word |
+ {1:<<<}d word word word |
line three |
long word long word long word long word |
long word long word long word |
line |*2
^line |
- ~ |*4
+ {1:~ }|*4
|
]]
local s6 = [[
- <<<d word word word word word word word |
+ {1:<<<}d word word word word word word word |
word word word word |
line three |
long word long word long word long word |
long word long word long word |
line |*2
^line |
- ~ |*3
+ {1:~ }|*3
|
]]
local s7 = [[
@@ -105,7 +106,7 @@ describe('smoothscroll', function()
long word long word long word |
line |*2
^line |
- ~ |*2
+ {1:~ }|*2
|
]]
local s8 = [[
@@ -117,7 +118,7 @@ describe('smoothscroll', function()
long word long word long word |
line |*2
^line |
- ~ |
+ {1:~ }|
|
]]
feed('<C-E>')
@@ -160,7 +161,7 @@ describe('smoothscroll', function()
ϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛϛ^ϛϛϛϛϛ|
ϛϛϛϛϛ |
222222222222222222222222222222222222 |
- ~ |*2
+ {1:~ }|*2
|
]])
end)
@@ -181,134 +182,136 @@ describe('smoothscroll', function()
endfunc
]])
screen:expect([[
- 1 one word word word word word word wo|
+ {8: 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|
+ {8: 2 }two long word long word long word lo|
ng word long word long word long word |
- 3 ^line |
- 4 line |
- 5 line |
- ~ |*3
+ {8: 3 }^line |
+ {8: 4 }line |
+ {8: 5 }line |
+ {1:~ }|*3
|
]])
feed('<C-E>')
screen:expect([[
- <<<word word word word word word word wo|
+ {1:<<<}word word word word word word word wo|
rd word word word word word |
- 2 two long word long word long word lo|
+ {8: 2 }two long word long word long word lo|
ng word long word long word long word |
- 3 ^line |
- 4 line |
- 5 line |
- ~ |*4
+ {8: 3 }^line |
+ {8: 4 }line |
+ {8: 5 }line |
+ {1:~ }|*4
|
]])
feed('<C-E>')
screen:expect([[
- <<<word word word word word |
- 2 two long word long word long word lo|
+ {1:<<<}word word word word word |
+ {8: 2 }two long word long word long word lo|
ng word long word long word long word |
- 3 ^line |
- 4 line |
- 5 line |
- ~ |*5
+ {8: 3 }^line |
+ {8: 4 }line |
+ {8: 5 }line |
+ {1:~ }|*5
|
]])
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 |
- ~ |*4
+ {1:<<<}{8: }d word word word word word word |
+ {8: 2 }two long word long word long word lo|
+ {8: }ng word long word long word long wor|
+ {8: }d |
+ {8: 3 }^line |
+ {8: 4 }line |
+ {8: 5 }line |
+ {1:~ }|*4
|
]])
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 |
- ~ |*3
+ {1:<<<}{8: }rd word word word word word word wor|
+ {8: }d word word word word word word |
+ {8: 2 }two long word long word long word lo|
+ {8: }ng word long word long word long wor|
+ {8: }d |
+ {8: 3 }^line |
+ {8: 4 }line |
+ {8: 5 }line |
+ {1:~ }|*3
|
]])
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 |
- ~ |*2
+ {8: 1 }one word word word word word word wo|
+ {8: }rd word word word word word word wor|
+ {8: }d word word word word word word |
+ {8: 2 }two long word long word long word lo|
+ {8: }ng word long word long word long wor|
+ {8: }d |
+ {8: 3 }^line |
+ {8: 4 }line |
+ {8: 5 }line |
+ {1:~ }|*2
|
]])
exec('botright split')
feed('gg')
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@@@|
- [No Name] [+] |
- 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 @@@|
- [No Name] [+] |
+ {8: 1 }one word word word word word word wo|
+ {8: }rd word word word word word word wor|
+ {8: }d word word word word word word |
+ {8: 2 }two long word long word long word{1:@@@}|
+ {2:[No Name] [+] }|
+ {8: 1 }^one word word word word word word wo|
+ {8: }rd word word word word word word wor|
+ {8: }d word word word word word word |
+ {8: 2 }two long word long word long word lo|
+ {8: }ng word long word long word long {1:@@@}|
+ {3:[No Name] [+] }|
|
]])
+
feed('<C-E>')
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@@@|
- [No Name] [+] |
- <<< 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 |
- [No Name] [+] |
+ {8: 1 }one word word word word word word wo|
+ {8: }rd word word word word word word wor|
+ {8: }d word word word word word word |
+ {8: 2 }two long word long word long word{1:@@@}|
+ {2:[No Name] [+] }|
+ {1:<<<}{8: }rd word word word word word word wor|
+ {8: }d word word word word word word^ |
+ {8: 2 }two long word long word long word lo|
+ {8: }ng word long word long word long wor|
+ {8: }d |
+ {3:[No Name] [+] }|
|
]])
+
feed('<C-E>')
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@@@|
- [No Name] [+] |
- <<< 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 |
- [No Name] [+] |
+ {8: 1 }one word word word word word word wo|
+ {8: }rd word word word word word word wor|
+ {8: }d word word word word word word |
+ {8: 2 }two long word long word long word{1:@@@}|
+ {2:[No Name] [+] }|
+ {1:<<<}{8: }d word word word word word word^ |
+ {8: 2 }two long word long word long word lo|
+ {8: }ng word long word long word long wor|
+ {8: }d |
+ {8: 3 }line |
+ {3:[No Name] [+] }|
|
]])
exec('close')
exec('call DoRel()')
screen:expect([[
- 2<<<^ong text very long text very long te|
- xt very long text very long text ver|
- y long text very long text very long|
- text very long text very long text |
- 1 three |
- ~ |*6
+ {8:2}{1:<<<}^ong text very long text very long te|
+ {8: }xt very long text very long text ver|
+ {8: }y long text very long text very long|
+ {8: } text very long text very long text |
+ {8: 1 }three |
+ {1:~ }|*6
--No lines in buffer-- |
]])
end)
@@ -323,22 +326,22 @@ describe('smoothscroll', function()
exe "normal 2Gzt\<C-E>"
]])
screen:expect([[
- <<<t very long text very long text very |
+ {1:<<<}t very long text very long text very |
^long text very long text very long text |
very long text very long text very long |
- text very long text- |
+ text very long text{1:-} |
three |
- ~ |*2
+ {1:~ }|*2
|
]])
exec('set listchars+=precedes:#')
screen:expect([[
- #ext very long text very long text very |
+ {1:#}ext very long text very long text very |
^long text very long text very long text |
very long text very long text very long |
- text very long text- |
+ text very long text{1:-} |
three |
- ~ |*2
+ {1:~ }|*2
|
]])
end)
@@ -356,13 +359,14 @@ describe('smoothscroll', function()
set smoothscroll
diffthis
]])
+
screen:expect([[
- - ^just some text here |
- ~ |*2
- [No Name] [+] |
- - just some text here |
- ~ |
- [No Name] [+] |
+ {7:- }^just some text here |
+ {1:~ }|*2
+ {3:[No Name] [+] }|
+ {7:- }just some text here |
+ {1:~ }|
+ {2:[No Name] [+] }|
|
]])
feed('<C-Y>')
@@ -380,7 +384,7 @@ describe('smoothscroll', function()
:3
]])
screen:expect([[
- <<<h some text with some text |
+ {1:<<<}h some text with some text |
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
@@ -401,7 +405,7 @@ describe('smoothscroll', function()
-- moving cursor up right after the <<< marker - no need to show whole line
feed('2gj3l2k')
screen:expect([[
- <<<^h some text with some text |
+ {1:<<<}^h some text with some text |
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
@@ -419,7 +423,7 @@ describe('smoothscroll', function()
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
- @ |
+ {1:@ }|
|
]])
end)
@@ -443,7 +447,7 @@ describe('smoothscroll', function()
]])
feed('<C-E>')
screen:expect([[
- <<<th lot^s of text with lots of text wit|
+ {1:<<<}th lot^s of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text with lots of te|
@@ -452,7 +456,7 @@ describe('smoothscroll', function()
]])
feed('5<C-E>')
screen:expect([[
- <<< lots ^of text with lots of text with |
+ {1:<<<} lots ^of text with lots of text with |
lots of text with lots of text with lots|
of text with lots of text with lots of |
text with lots of text with lots of text|
@@ -462,7 +466,7 @@ describe('smoothscroll', function()
-- scrolling down, cursor moves screen line up
feed('5<C-Y>')
screen:expect([[
- <<<th lots of text with lots of text wit|
+ {1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text with lots of te|
@@ -482,7 +486,7 @@ describe('smoothscroll', function()
exec('set scrolloff=1')
feed('10|<C-E>')
screen:expect([[
- <<<th lots of text with lots of text wit|
+ {1:<<<}th lots of text with lots of text wit|
h lots of^ text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text with lots of te|
@@ -492,7 +496,7 @@ describe('smoothscroll', function()
-- 'scrolloff' set to 1, scrolling down, cursor moves screen line up
feed('<C-E>gjgj<C-Y>')
screen:expect([[
- <<<th lots of text with lots of text wit|
+ {1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text wi^th lots of text with lots of te|
@@ -503,7 +507,7 @@ describe('smoothscroll', function()
exec('set scrolloff=2')
feed('10|<C-E>')
screen:expect([[
- <<<th lots of text with lots of text wit|
+ {1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of tex^t with lots of text with lots o|
f text with lots of text with lots of te|
@@ -518,7 +522,7 @@ describe('smoothscroll', function()
exec('set scrolloff=0')
feed('0j')
screen:expect([[
- <<<th lots of text with lots of text wit|
+ {1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text end |
@@ -529,20 +533,20 @@ describe('smoothscroll', function()
feed('zt')
screen:expect([[
^four |
- ~ |*4
+ {1:~ }|*4
|
]])
feed('zz')
screen:expect([[
- <<<of text with lots of text with lots o|
+ {1:<<<}of text with lots of text with lots o|
f text with lots of text end |
^four |
- ~ |*2
+ {1:~ }|*2
|
]])
feed('zb')
screen:expect([[
- <<<th lots of text with lots of text wit|
+ {1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text end |
@@ -567,7 +571,7 @@ describe('smoothscroll', function()
-- screen.
feed('3Gzt<C-E>j')
screen:expect([[
- <<<th lots of text with lots of text wit|
+ {1:<<<}th lots of text with lots of text wit|
h lots of text with lots of text with lo|
ts of text with lots of text with lots o|
f text with lots of text end |
@@ -588,16 +592,16 @@ describe('smoothscroll', function()
lots of text with lots of text with lot|
s of text with lots of text with lots of|
text |
- ~ |
+ {1:~ }|
|
]]
screen:expect(s1)
feed('<C-E>')
screen:expect([[
- <<<ts of text with lots of text with lot|
+ {1:<<<}ts of text with lots of text with lot|
^s of text with lots of text with lots of|
text |
- ~ |*2
+ {1:~ }|*2
|
]])
feed('0')
@@ -612,20 +616,20 @@ describe('smoothscroll', function()
exec('set smoothscroll scrolloff=0 showbreak=+++\\ ')
local s1 = [[
^with lots of text in one line with lots |
- +++ of text in one line with lots of tex|
- +++ t in one line with lots of text in o|
- +++ ne line with lots of text in one lin|
- +++ e with lots of text in one line |
+ {1:+++ }of text in one line with lots of tex|
+ {1:+++ }t in one line with lots of text in o|
+ {1:+++ }ne line with lots of text in one lin|
+ {1:+++ }e with lots of text in one line |
|
]]
screen:expect(s1)
feed('<C-E>')
screen:expect([[
- +++ ^of text in one line with lots of tex|
- +++ t in one line with lots of text in o|
- +++ ne line with lots of text in one lin|
- +++ e with lots of text in one line |
- ~ |
+ {1:+++ }^of text in one line with lots of tex|
+ {1:+++ }t in one line with lots of text in o|
+ {1:+++ }ne line with lots of text in one lin|
+ {1:+++ }e with lots of text in one line |
+ {1:~ }|
|
]])
feed('0')
@@ -642,13 +646,13 @@ describe('smoothscroll', function()
screen:expect([[
^aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
口口口口口口口口口口 |
- ~ |*3
+ {1:~ }|*3
|
]])
feed('<C-E>')
screen:expect([[
- <<< 口口口口口口口^口 |
- ~ |*4
+ {1:<<<} 口口口口口口口^口 |
+ {1:~ }|*4
|
]])
end)
@@ -656,10 +660,6 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_zero_width()
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 },
- })
exec([[
call setline(1, ['a'->repeat(100)])
set wrap smoothscroll number laststatus=0
@@ -669,12 +669,12 @@ describe('smoothscroll', function()
wincmd v
]])
screen:expect([[
- {1: 1^ }│{1: }│{1: }│{1: }│{1: }|
+ {8: 1^ }│{8: }│{8: }│{8: }│{8: }|
|
]])
feed('llllllllll<C-W>o')
screen:expect([[
- {2:<<<}{1: }aa^aaaaaa|
+ {1:<<<}{8: }aa^aaaaaa|
|
]])
end)
@@ -694,7 +694,7 @@ describe('smoothscroll', function()
]=])
feed('<C-E>gjgk')
screen:expect([[
- <<<lots of text in one line^ |
+ {1:<<<}lots of text in one line^ |
line two |
line three |
line four |
@@ -717,7 +717,7 @@ describe('smoothscroll', function()
call search('xxx')
]=])
screen:expect([[
- <<<_____________________________________|
+ {1:<<<}_____________________________________|
________________________________________|
______________________________________^xx|
x______________________________________x|
@@ -741,10 +741,10 @@ describe('smoothscroll', function()
|
]])
exec("call setline(92, 'a'->repeat(100))")
- feed('<C-B>G')
+ feed('<C-L><C-B>G')
-- cursor is not placed below window
screen:expect([[
- <<<aaaaaaaaaaaaaaaaa |
+ {1:<<<}aaaaaaaaaaaaaaaaa |
|*7
^ |
|
@@ -754,12 +754,6 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_incsearch()
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 },
- })
exec([[
set smoothscroll number scrolloff=0 incsearch
call setline(1, repeat([''], 20))
@@ -768,46 +762,46 @@ describe('smoothscroll', function()
]])
feed('/b')
screen:expect([[
- {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1: 12 } |
- {1: 13 } |
- {1: 14 }{4:b}{3:bbb} |
- {1: 15 } |
- {1: 16 } |
- {1: 17 } |
+ {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8: 12 } |
+ {8: 13 } |
+ {8: 14 }{2:b}{10:bbb} |
+ {8: 15 } |
+ {8: 16 } |
+ {8: 17 } |
/b^ |
]])
feed('b')
screen:expect([[
- {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1: 12 } |
- {1: 13 } |
- {1: 14 }{4:bb}{3:bb} |
- {1: 15 } |
- {1: 16 } |
- {1: 17 } |
+ {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8: 12 } |
+ {8: 13 } |
+ {8: 14 }{2:bb}{10:bb} |
+ {8: 15 } |
+ {8: 16 } |
+ {8: 17 } |
/bb^ |
]])
feed('b')
screen:expect([[
- {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1: 12 } |
- {1: 13 } |
- {1: 14 }{4:bbb}b |
- {1: 15 } |
- {1: 16 } |
- {1: 17 } |
+ {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8: 12 } |
+ {8: 13 } |
+ {8: 14 }{2:bbb}b |
+ {8: 15 } |
+ {8: 16 } |
+ {8: 17 } |
/bbb^ |
]])
feed('b')
screen:expect([[
- {2:<<<}{1: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
- {1: 12 } |
- {1: 13 } |
- {1: 14 }{4:bbbb} |
- {1: 15 } |
- {1: 16 } |
- {1: 17 } |
+ {1:<<<}{8: }aaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+ {8: 12 } |
+ {8: 13 } |
+ {8: 14 }{2:bbbb} |
+ {8: 15 } |
+ {8: 16 } |
+ {8: 17 } |
/bbbb^ |
]])
end)
@@ -815,10 +809,6 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_multi_skipcol()
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 },
- })
exec([[
setlocal cursorline scrolloff=0 smoothscroll
call setline(1, repeat([''], 8))
@@ -829,7 +819,7 @@ describe('smoothscroll', function()
redraw
]])
screen:expect([[
- {1:^ }|
+ {21:^ }|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaa |
@@ -841,22 +831,22 @@ describe('smoothscroll', function()
]])
feed('3<C-E>')
screen:expect([[
- {0:<<<}{1:aaaaaa^a }|
+ {1:<<<}{21:aaaaaa^a }|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
aaaaaaaaaa |
|*2
bbb |
ccc |
- {0:~ }|*2
+ {1:~ }|*2
|
]])
feed('2<C-E>')
screen:expect([[
- {0:<<<}{1:aaaaaa^a }|
+ {1:<<<}{21:aaaaaa^a }|
|*2
bbb |
ccc |
- {0:~ }|*4
+ {1:~ }|*4
|
]])
end)
@@ -864,12 +854,6 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_zero_width_scroll_cursor_bot()
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
- })
exec([[
silent normal yy
silent normal 19p
@@ -882,10 +866,10 @@ describe('smoothscroll', function()
silent normal 20G
]])
screen:expect([[
- {1: }│ |
- {2:@}│ |*15
- {2:^@}│ |
- {3:< }{4:[No Name] [+] }|
+ {8: }│ |
+ {1:@}│ |*15
+ {1:^@}│ |
+ {3:< }{2:[No Name] [+] }|
|
]])
end)
@@ -901,15 +885,15 @@ describe('smoothscroll', function()
]])
screen:expect([[
|
- [No Name] |
+ {2:[No Name] }|
line1 |
line2 |
^line3line3line3line3line3line3line3line3|
line3line3line3line3line3line3line3line3|
line3line3line3line3 |
line4 |
- ~ |*2
- [No Name] [+] |
+ {1:~ }|*2
+ {3:[No Name] [+] }|
|
]])
end)
@@ -929,6 +913,119 @@ describe('smoothscroll', function()
assert_alive()
end)
+ -- oldtest: Test_smoothscroll_insert_bottom()
+ 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([[
+ {1:<<<}ery long line ...A very long line ...|
+ A very long line ...A very long line ...|*5
+ 123456789 |
+ ^ |
+ {5:-- INSERT --} |
+ ]])
+ end)
+
+ -- oldtest: Test_smoothscroll_in_qf_window()
+ it('works in quickfix window when changing quickfix list', function()
+ screen:try_resize(60, 20)
+ exec([[
+ set nocompatible display=lastline
+ copen 5
+ setlocal number smoothscroll
+ let g:l = [{'text': 'foo'}] + repeat([{'text': join(range(30))}], 10)
+ call setqflist(g:l, 'r')
+ normal! G
+ wincmd t
+ let g:l1 = [{'text': join(range(1000))}]
+ ]])
+ screen:expect([[
+ ^ |
+ {1:~ }|*11
+ {3:[No Name] }|
+ {1:<<<}{8: }21 22 23 24 25 26 27 28 29 |
+ {8: 10 }|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
+ {8: }21 22 23 24 25 26 27 28 29 |
+ {8: 11 }|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
+ {8: }21 22 23 24 25 26 27 28 29 |
+ {2:[Quickfix List] }|
+ |
+ ]])
+
+ feed([[:call setqflist([], 'r')<CR>]])
+ local screen_empty = [[
+ ^ |
+ {1:~ }|*11
+ {3:[No Name] }|
+ {8: 1 } |
+ {1:~ }|*4
+ {2:[Quickfix List] }|
+ :call setqflist([], 'r') |
+ ]]
+ screen:expect(screen_empty)
+
+ feed([[:call setqflist(g:l, 'r')<CR>]])
+ local screen_l_top = [[
+ ^ |
+ {1:~ }|*11
+ {3:[No Name] }|
+ {8: 1 }{10:|| foo }|
+ {8: 2 }|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
+ {8: }21 22 23 24 25 26 27 28 29 |
+ {8: 3 }|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
+ {8: }21 22 23 24 25 26 27 28 29 |
+ {2:[Quickfix List] }|
+ :call setqflist(g:l, 'r') |
+ ]]
+ screen:expect(screen_l_top)
+
+ feed([[:call setqflist(g:l1, 'r')<CR>]])
+ local screen_l1_top = [[
+ ^ |
+ {1:~ }|*11
+ {3:[No Name] }|
+ {8: 1 }{10:|| 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 }|
+ {8: }{10:21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39}|
+ {8: }{10: 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 5}|
+ {8: }{10:8 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 }|
+ {8: }{10:77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95}|
+ {2:[Quickfix List] }|
+ :call setqflist(g:l1, 'r') |
+ ]]
+ screen:expect(screen_l1_top)
+
+ feed('<C-W>b$<C-W>t')
+ local screen_l1_bot = [[
+ ^ |
+ {1:~ }|*11
+ {3:[No Name] }|
+ {1:<<<}{8: }{10: 937 938 939 940 941 942 943 944 945 946 947 948 949 950}|
+ {8: }{10: 951 952 953 954 955 956 957 958 959 960 961 962 963 964}|
+ {8: }{10: 965 966 967 968 969 970 971 972 973 974 975 976 977 978}|
+ {8: }{10: 979 980 981 982 983 984 985 986 987 988 989 990 991 992}|
+ {8: }{10: 993 994 995 996 997 998 999 }|
+ {2:[Quickfix List] }|
+ :call setqflist(g:l1, 'r') |
+ ]]
+ screen:expect(screen_l1_bot)
+
+ feed([[:call setqflist([], 'r')<CR>]])
+ screen:expect(screen_empty)
+
+ feed([[:call setqflist(g:l1, 'r')<CR>]])
+ screen:expect(screen_l1_top)
+
+ feed('<C-W>b$<C-W>t')
+ screen:expect(screen_l1_bot)
+
+ feed([[:call setqflist(g:l, 'r')<CR>]])
+ screen:expect(screen_l_top)
+ end)
+
it('works with virt_lines above and below', function()
screen:try_resize(55, 7)
exec([=[
@@ -952,7 +1049,7 @@ describe('smoothscroll', function()
]])
feed('<C-E>')
screen:expect([[
- <<<e text with some text with some text with some text |
+ {1:<<<}e text with some text with some text with some text |
virt_below1 |
virt_above1 |
^Line with some text with some text with some text with |
@@ -977,7 +1074,7 @@ describe('smoothscroll', function()
some text with some text with some text with some text |
virt_below2 |
virt_above2 |
- Line with some text with some text with some text wi@@@|
+ Line with some text with some text with some text wi{1:@@@}|
|
]])
feed('<C-E>')
@@ -992,124 +1089,199 @@ describe('smoothscroll', function()
]])
feed('<C-E>')
screen:expect([[
- <<<e text with some text with some text with some tex^t |
+ {1:<<<}e text with some text with some text with some tex^t |
virt_below2 |
virt_above2 |
Line with some text with some text with some text with |
some text with some text with some text with some text |
- ~ |
+ {1:~ }|
|
]])
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)
+ screen:set_default_attr_ids({
+ [1] = { foreground = Screen.colors.Blue1, bold = true },
+ [2] = { reverse = true },
+ [3] = { bold = true, reverse = true },
+ [4] = { background = Screen.colors.LightMagenta },
+ [5] = { bold = true },
+ [31] = { foreground = Screen.colors.Fuchsia, bold = true },
+ })
exec([[
call setline(1, ['Line' .. (' with some text'->repeat(7))]->repeat(7))
set smoothscroll scrolloff=0
norm sj
]])
screen:expect([[
- <<<e text with some text with some text |
+ {1:<<<}e text with some text with some text |
with some text with some text |
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
- [No Name] [+] |
- <<<e text with some text with some text |
+ {2:[No Name] [+] }|
+ {1:<<<}e text with some text with some text |
^with some text with some text |
Line with some text with some text with |
- some text with some text with some te@@@|
- [No Name] [+] |
+ some text with some text with some te{1:@@@}|
+ {3:[No Name] [+] }|
|
]])
exec('set showtabline=2')
feed('<C-E>')
screen:expect([[
- 2+ [No Name] |
- <<<e text with some text with some text |
+ {5: }{31:2}{5:+ [No Name] }{2: }|
+ {1:<<<}e text with some text with some text |
with some text with some text |
Line with some text with some text with |
some text with some text with some text |
with some text with some text |
- [No Name] [+] |
- <<<e text with some text with some text |
+ {2:[No Name] [+] }|
+ {1:<<<}e text with some text with some text |
^with some text with some text |
- Line with some text with some text wi@@@|
- [No Name] [+] |
+ Line with some text with some text wi{1:@@@}|
+ {3:[No Name] [+] }|
|
]])
exec('set winbar=winbar')
feed('<C-w>k<C-E>')
screen:expect([[
- 2+ [No Name] |
- winbar |
- <<<e text with some text with some text |
+ {5: }{31:2}{5:+ [No Name] }{2: }|
+ {5:winbar }|
+ {1:<<<}e text with some text with some text |
^with some text with some text |
Line with some text with some text with |
- some text with some text with some te@@@|
- [No Name] [+] |
- winbar |
- <<<e text with some text with some text |
+ some text with some text with some te{1:@@@}|
+ {3:[No Name] [+] }|
+ {5:winbar }|
+ {1:<<<}e text with some text with some text |
with some text with some text |
- [No Name] [+] |
+ {2:[No Name] [+] }|
|
]])
end)
it('works with very long line', function()
- screen:set_default_attr_ids({
- [1] = { foreground = Screen.colors.Brown },
- [2] = { foreground = Screen.colors.Blue1, bold = true },
- })
exec([[
edit test/functional/fixtures/bigfile_oneline.txt
setlocal smoothscroll number
]])
screen:expect([[
- {1: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;|
- {1: }; 0001;<control>;Cc;0;BN;;;;;N;START|
- {1: } OF HEADING;;;; 0002;<control>;Cc;0;|
- {1: }BN;;;;;N;START OF TEXT;;;; 0003;<con|
- {1: }trol>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
- {1: }0004;<control>;Cc;0;BN;;;;;N;END OF |
- {1: }TRANSMISSION;;;; 0005;<control>;Cc;0|
- {1: };BN;;;;;N;ENQUIRY;;;; 0006;<control>|
- {1: };Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; 0007;|
- {1: }<control>;Cc;0;BN;;;;;N;BELL;;;; 000|
- {1: }8;<control>;Cc;0;BN;;;;;N;BACKSPACE;|
+ {8: 1 }^0000;<control>;Cc;0;BN;;;;;N;NULL;;;|
+ {8: }; 0001;<control>;Cc;0;BN;;;;;N;START|
+ {8: } OF HEADING;;;; 0002;<control>;Cc;0;|
+ {8: }BN;;;;;N;START OF TEXT;;;; 0003;<con|
+ {8: }trol>;Cc;0;BN;;;;;N;END OF TEXT;;;; |
+ {8: }0004;<control>;Cc;0;BN;;;;;N;END OF |
+ {8: }TRANSMISSION;;;; 0005;<control>;Cc;0|
+ {8: };BN;;;;;N;ENQUIRY;;;; 0006;<control>|
+ {8: };Cc;0;BN;;;;;N;ACKNOWLEDGE;;;; 0007;|
+ {8: }<control>;Cc;0;BN;;;;;N;BELL;;;; 000|
+ {8: }8;<control>;Cc;0;BN;;;;;N;BACKSPACE;|
|
]])
feed('j')
screen:expect([[
- {2:<<<}{1: }CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo|
- {1: };0;L;243AB;;;;N;;;;; 2F920;CJK COMPA|
- {1: }TIBILITY IDEOGRAPH-2F920;Lo;0;L;7228|
- {1: };;;;N;;;;; 2F921;CJK COMPATIBILITY I|
- {1: }DEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;;|
- {1: } 2F922;CJK COMPATIBILITY IDEOGRAPH-2|
- {1: }F922;Lo;0;L;7250;;;;N;;;;; |
- {1: 2 }^2F923;CJK COMPATIBILITY IDEOGRAPH-2F|
- {1: }923;Lo;0;L;24608;;;;N;;;;; |
- {1: 3 }2F924;CJK COMPATIBILITY IDEOGRAPH-2F|
- {1: }924;Lo;0;L;7280;;;;N;;;;; |
+ {1:<<<}{8: }CJK COMPATIBILITY IDEOGRAPH-2F91F;Lo|
+ {8: };0;L;243AB;;;;N;;;;; 2F920;CJK COMPA|
+ {8: }TIBILITY IDEOGRAPH-2F920;Lo;0;L;7228|
+ {8: };;;;N;;;;; 2F921;CJK COMPATIBILITY I|
+ {8: }DEOGRAPH-2F921;Lo;0;L;7235;;;;N;;;;;|
+ {8: } 2F922;CJK COMPATIBILITY IDEOGRAPH-2|
+ {8: }F922;Lo;0;L;7250;;;;N;;;;; |
+ {8: 2 }^2F923;CJK COMPATIBILITY IDEOGRAPH-2F|
+ {8: }923;Lo;0;L;24608;;;;N;;;;; |
+ {8: 3 }2F924;CJK COMPATIBILITY IDEOGRAPH-2F|
+ {8: }924;Lo;0;L;7280;;;;N;;;;; |
|
]])
end)
+
+ it('works with very long line and scrolloff', function()
+ screen:try_resize(40, 8)
+ exec([[
+ set smoothscroll scrolloff=3
+ call setline(1, ['one', 'two long '->repeat(100), 'three', 'four', 'five', 'six'])
+ ]])
+ --FIXME: incorrect screen due to reset_skipcol()/curs_columns() shenanigans
+ feed(':norm j721|<CR>')
+ screen:expect([[
+ two long two long two long two long two |
+ long two long two long two long two long|
+ two long two long two long two long two|
+ ^ long two long two long two long two lon|
+ g two long two long two long two long tw|
+ o long two long two long two long two lo|
+ ng two long two long two long two long t|
+ :norm j721| |
+ ]])
+ feed('gj')
+ screen:expect([[
+ {1:<<<}two long two long two long two long t|
+ wo long two long two long two long two l|
+ ong two long two long two long two long |
+ two long two long two long two long two |
+ ^long two long two long two long two long|
+ two long two long two long two long two|
+ long two long two long two long two lon|
+ :norm j721| |
+ ]])
+ feed('gj')
+ screen:expect([[
+ {1:<<<}long two long two long two long two l|
+ ong two long two long two long two long |
+ two long two long two long two long two |
+ long two long two long two long two long|
+ ^ two long two long two long two long two|
+ long two long two long two long two lon|
+ g two long two long |
+ :norm j721| |
+ ]])
+ feed('gj')
+ screen:expect([[
+ {1:<<<}long two long two long two long two l|
+ ong two long two long two long two long |
+ two long two long two long two long two |
+ long two long two long two long two long|
+ two long two long two long two long two|
+ ^ long two long two long two long two lon|
+ g two long two long |
+ :norm j721| |
+ ]])
+ feed('gj')
+ screen:expect([[
+ {1:<<<}long two long two long two long two l|
+ ong two long two long two long two long |
+ two long two long two long two long two |
+ long two long two long two long two long|
+ two long two long two long two long two|
+ long two long two long two long two lon|
+ ^g two long two long |
+ :norm j721| |
+ ]])
+ feed('gj')
+ screen:expect([[
+ {1:<<<} long two long two long two long two |
+ long two long two long two long two long|
+ two long two long two long two long two|
+ long two long two long two long two lon|
+ g two long two long |
+ ^three |
+ four |
+ :norm j721| |
+ ]])
+ feed('gk')
+ --FIXME: incorrect screen due to reset_skipcol()/curs_columns() shenanigans
+ screen:expect([[
+ two long two long two long two long two |
+ long two long two long two long two long|
+ two long two long two long two long two|
+ long two long two long two long two lon|
+ g two long two long two long two long tw|
+ o long two long two long two long two lo|
+ ^ng two long two long two long two long t|
+ :norm j721| |
+ ]])
+ end)
end)