aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua32
-rw-r--r--test/old/testdir/test_scroll_opt.vim47
2 files changed, 60 insertions, 19 deletions
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
index 2f88221032..a05470418f 100644
--- a/test/functional/legacy/scroll_opt_spec.lua
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -279,8 +279,8 @@ describe('smoothscroll', function()
]])
exec('call DoRel()')
screen:expect([[
- 2<<<ong text very long text very long te|
- ^xt very long text very long text ver|
+ 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 |
@@ -380,8 +380,20 @@ describe('smoothscroll', function()
screen:expect_unchanged()
feed('G')
screen:expect_unchanged()
- -- moving cursor up - whole top line shows
- feed('2k')
+ -- moving cursor up right after the >>> marker - no need to show whole line
+ feed('2gj3l2k')
+ screen:expect([[
+ <<<^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 |
+ Line with some text with some text with |
+ some text with some text with some text |
+ with some text with some text |
+ |
+ ]])
+ -- moving cursor up where the >>> marker is - whole top line shows
+ feed('2j02k')
screen:expect([[
^Line with some text with some text with |
some text with some text with some text |
@@ -524,11 +536,9 @@ describe('smoothscroll', function()
-- oldtest: Test_smoothscroll_long_line_showbreak()
it("cursor is not one screen line too far down", function()
screen:try_resize(40, 6)
- exec([[
- " a line that spans four screen lines
- call setline(1, 'with lots of text in one line '->repeat(6))
- set smoothscroll scrolloff=0 showbreak=+++\
- ]])
+ -- a line that spans four screen lines
+ exec("call setline(1, 'with lots of text in one line '->repeat(6))")
+ 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|
@@ -540,8 +550,8 @@ describe('smoothscroll', function()
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|
+ +++ ^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 |
~ |
diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim
index 657172edea..b9645898e8 100644
--- a/test/old/testdir/test_scroll_opt.vim
+++ b/test/old/testdir/test_scroll_opt.vim
@@ -247,10 +247,14 @@ func Test_smoothscroll_wrap_scrolloff_zero()
call term_sendkeys(buf, "G")
call VerifyScreenDump(buf, 'Test_smooth_wrap_4', {})
- " moving cursor up - whole top line shows
- call term_sendkeys(buf, "2k")
+ " moving cursor up right after the >>> marker - no need to show whole line
+ call term_sendkeys(buf, "2gj3l2k")
call VerifyScreenDump(buf, 'Test_smooth_wrap_5', {})
+ " moving cursor up where the >>> marker is - whole top line shows
+ call term_sendkeys(buf, "2j02k")
+ call VerifyScreenDump(buf, 'Test_smooth_wrap_6', {})
+
call StopVimInTerminal(buf)
endfunc
@@ -338,7 +342,6 @@ func Test_smoothscroll_long_line_showbreak()
let buf = RunVimInTerminal('-S XSmoothLongShowbreak', #{rows: 6, cols: 40})
call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {})
- " FIXME: this currently has the cursor in screen line 2, should be one up.
call term_sendkeys(buf, "\<C-E>")
call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_2', {})
@@ -370,10 +373,16 @@ func Test_smoothscroll_cursor_position()
call s:check_col_calc(1, 2, 41)
exe "normal \<C-Y>"
call s:check_col_calc(1, 3, 41)
- normal ggg$
+
+ normal gg3l
exe "normal \<C-E>"
" Move down only 1 line when we are out of the range of the <<< display
+ call s:check_col_calc(4, 1, 24)
+ exe "normal \<C-Y>"
+ call s:check_col_calc(4, 2, 24)
+ normal ggg$
+ exe "normal \<C-E>"
call s:check_col_calc(20, 1, 40)
exe "normal \<C-Y>"
call s:check_col_calc(20, 2, 40)
@@ -383,9 +392,11 @@ func Test_smoothscroll_cursor_position()
setl number
call s:check_col_calc(5, 1, 1)
exe "normal \<C-E>"
- call s:check_col_calc(5, 2, 33)
+
+ " Move down only 1 line when the <<< display is on the number column
+ call s:check_col_calc(5, 1, 17)
exe "normal \<C-Y>"
- call s:check_col_calc(5, 3, 33)
+ call s:check_col_calc(5, 2, 17)
normal ggg$
exe "normal \<C-E>"
call s:check_col_calc(20, 1, 32)
@@ -393,13 +404,33 @@ func Test_smoothscroll_cursor_position()
call s:check_col_calc(20, 2, 32)
normal gg
+ setl numberwidth=1
+
+ " Move down another line when numberwidth is too short to cover the whole
+ " <<< display
+ call s:check_col_calc(3, 1, 1)
+ exe "normal \<C-E>"
+ call s:check_col_calc(3, 2, 37)
+ exe "normal \<C-Y>"
+ call s:check_col_calc(3, 3, 37)
+ normal ggl
+
+ " Only move 1 line down when we are just past the <<< display
+ call s:check_col_calc(4, 1, 2)
+ exe "normal \<C-E>"
+ call s:check_col_calc(4, 1, 20)
+ exe "normal \<C-Y>"
+ call s:check_col_calc(4, 2, 20)
+ normal gg
+ setl numberwidth&
+
" Test number + showbreak, so test that the additional indentation works
setl number showbreak=+++
call s:check_col_calc(5, 1, 1)
exe "normal \<C-E>"
- call s:check_col_calc(8, 2, 30)
+ call s:check_col_calc(8, 1, 17)
exe "normal \<C-Y>"
- call s:check_col_calc(8, 3, 30)
+ call s:check_col_calc(8, 2, 17)
normal gg
" Test number + cpo+=n mode, where wrapped lines aren't indented