patch 9.0.2187: Visual not drawn with 'breakindent' when line doesn't fit
Problem: Visual selection isn't drawn with 'breakindent' when the line
doesn't fit in the window (Jaehwang Jung)
Solution: Adjust wlv->fromcol also for 'breakindent' (zeertzjq)
closes: #13767
closes: #13768
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_breakindent.vim b/src/testdir/test_breakindent.vim
index 3c4d0f1..ee05548 100644
--- a/src/testdir/test_breakindent.vim
+++ b/src/testdir/test_breakindent.vim
@@ -923,6 +923,29 @@
call StopVimInTerminal(buf)
endfunc
+func Test_visual_starts_before_skipcol()
+ CheckScreendump
+
+ let lines =<< trim END
+ 1new
+ setlocal breakindent
+ call setline(1, "\t" .. join(range(100)))
+ END
+ call writefile(lines, 'XvisualStartsBeforeSkipcol', 'D')
+ let buf = RunVimInTerminal('-S XvisualStartsBeforeSkipcol', #{rows: 6})
+
+ call term_sendkeys(buf, "v$")
+ call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_1', {})
+ call term_sendkeys(buf, "\<Esc>:setlocal showbreak=+++\<CR>gv")
+ call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_2', {})
+ call term_sendkeys(buf, "\<Esc>:setlocal breakindentopt+=sbr\<CR>gv")
+ call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_3', {})
+ call term_sendkeys(buf, "\<Esc>:setlocal nobreakindent\<CR>gv")
+ call VerifyScreenDump(buf, 'Test_visual_starts_before_skipcol_4', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_no_spurious_match()
let s:input = printf('- y %s y %s', repeat('x', 50), repeat('x', 50))
call s:test_windows('setl breakindent breakindentopt=list:-1 formatlistpat=^- hls')