aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2023-04-27 18:20:34 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2023-05-02 13:11:47 +0200
commit0bcf2a6382eca34a827b678987e03874001d9610 (patch)
treeb18d81066eb3588fb1c5cff18ca84e5546ef2401
parenta2f3855291a59254346545f9699084fe4fece31f (diff)
downloadrneovim-0bcf2a6382eca34a827b678987e03874001d9610.tar.gz
rneovim-0bcf2a6382eca34a827b678987e03874001d9610.tar.bz2
rneovim-0bcf2a6382eca34a827b678987e03874001d9610.zip
vim-patch:9.0.0898: with 'smoothscroll' cursor is one screen line too far down
Problem: With 'smoothscroll' cursor is one screen line too far down. (Ernie Rael) Solution: Add a test that currently has the wrong result so that a fix can be made. (issue vim/vim#11436) https://github.com/vim/vim/commit/75ac25b4967cdcdfdf2d6c086a6e2308868c280a Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r--test/functional/legacy/scroll_opt_spec.lua30
-rw-r--r--test/old/testdir/test_scroll_opt.vim23
2 files changed, 53 insertions, 0 deletions
diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua
index 8f0286771a..2f88221032 100644
--- a/test/functional/legacy/scroll_opt_spec.lua
+++ b/test/functional/legacy/scroll_opt_spec.lua
@@ -520,4 +520,34 @@ describe('smoothscroll', function()
feed('0')
screen:expect(s1)
end)
+
+ -- 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=+++\
+ ]])
+ 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 |
+ |
+ ]]
+ 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 |
+ ~ |
+ |
+ ]])
+ feed('0')
+ screen:expect(s1)
+ end)
end)
diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim
index c3600ab4a7..657172edea 100644
--- a/test/old/testdir/test_scroll_opt.vim
+++ b/test/old/testdir/test_scroll_opt.vim
@@ -325,6 +325,29 @@ func Test_smoothscroll_one_long_line()
call StopVimInTerminal(buf)
endfunc
+func Test_smoothscroll_long_line_showbreak()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ # a line that spans four screen lines
+ setline(1, 'with lots of text in one line '->repeat(6))
+ set smoothscroll scrolloff=0 showbreak=+++\
+ END
+ call writefile(lines, 'XSmoothLongShowbreak', 'D')
+ 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', {})
+
+ call term_sendkeys(buf, "0")
+ call VerifyScreenDump(buf, 'Test_smooth_long_showbreak_1', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" Test that if the current cursor is on a smooth scrolled line, we correctly
" reposition it. Also check that we don't miscalculate the values by checking
" the consistency between wincol() and col('.') as they are calculated