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)

75ac25b496

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
Luuk van Baal 2023-04-27 18:20:34 +02:00
parent a2f3855291
commit 0bcf2a6382
2 changed files with 53 additions and 0 deletions

View File

@ -520,4 +520,34 @@ describe('smoothscroll', function()
feed('0') feed('0')
screen:expect(s1) screen:expect(s1)
end) 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) end)

View File

@ -325,6 +325,29 @@ func Test_smoothscroll_one_long_line()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
endfunc 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 " 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 " reposition it. Also check that we don't miscalculate the values by checking
" the consistency between wincol() and col('.') as they are calculated " the consistency between wincol() and col('.') as they are calculated