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)
diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim
index 5b08e84..1332ab5 100644
--- a/src/testdir/test_display.vim
+++ b/src/testdir/test_display.vim
@@ -471,9 +471,9 @@
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 @@
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