1
0
forked from aniani/vim

patch 9.0.1543: display errors when making topline shorter

Problem:    Display errors when making topline shorter and 'smoothscroll' is
            set.
Solution:   Reset w_skipcol when the topline becomes shorter than its current
            value. (Luuk van Baal, closes #12367)
This commit is contained in:
Luuk van Baal
2023-05-11 19:24:20 +01:00
committed by Bram Moolenaar
parent 6c018680be
commit 5d01f86d99
10 changed files with 77 additions and 14 deletions

View File

@@ -471,9 +471,9 @@ func Test_display_long_lastline()
CheckScreendump
let lines =<< trim END
set display=lastline
set display=lastline smoothscroll scrolloff=0
call setline(1, [
\'aaaaa'->repeat(100),
\'aaaaa'->repeat(150),
\'bbbbb '->repeat(7) .. 'ccccc '->repeat(7) .. 'ddddd '->repeat(7)
\])
END
@@ -481,11 +481,23 @@ func Test_display_long_lastline()
call writefile(lines, 'XdispLongline', 'D')
let buf = RunVimInTerminal('-S XdispLongline', #{rows: 14, cols: 35})
call term_sendkeys(buf, "482|")
call term_sendkeys(buf, "736|")
call VerifyScreenDump(buf, 'Test_display_long_line_1', {})
" The correct part of the last line is moved into view.
call term_sendkeys(buf, "D")
call VerifyScreenDump(buf, 'Test_display_long_line_2', {})
" "w_skipcol" does not change because the topline is still long enough
" to maintain the current skipcol.
call term_sendkeys(buf, "g04l11gkD")
call VerifyScreenDump(buf, 'Test_display_long_line_3', {})
" "w_skipcol" is reset to bring the entire topline into view because
" the line length is now smaller than the current skipcol + marker.
call term_sendkeys(buf, "x")
call VerifyScreenDump(buf, 'Test_display_long_line_4', {})
call StopVimInTerminal(buf)
endfunc