summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-06-10 19:40:30 +0100
committerBram Moolenaar <Bram@vim.org>2023-06-10 19:40:30 +0100
commitf578ca2c8f36b61ac3301fe8b59a8473c964cdc2 (patch)
tree1b2828f46909ddbb9d09b522019d406ebc1462ca
parentce723f391844695a07d9af02ef60330afd3e158c (diff)
patch 9.0.1626: Visual area not shown when using 'showbreak'v9.0.1626
Problem: Visual area not shown when using 'showbreak' and start of line is not visible. (Jaehwang Jung) Solution: Adjust "fromcol" for the space taken by 'showbreak'. (closes #12514)
-rw-r--r--src/drawline.c7
-rw-r--r--src/testdir/dumps/Test_visual_sbr_1.dump6
-rw-r--r--src/testdir/test_highlight.vim20
-rw-r--r--src/version.c2
4 files changed, 34 insertions, 1 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 848b3ae892..0638c56822 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -569,6 +569,11 @@ handle_showbreak_and_filler(win_T *wp, winlinevars_T *wlv)
if (wp->w_skipcol == 0 || wlv->startrow != 0 || !wp->w_p_wrap)
wlv->need_showbreak = FALSE;
wlv->vcol_sbr = wlv->vcol + MB_CHARLEN(sbr);
+
+ // Correct start of highlighted area for 'showbreak'.
+ if (wlv->fromcol >= wlv->vcol && wlv->fromcol < wlv->vcol_sbr)
+ wlv->fromcol = wlv->vcol_sbr;
+
// Correct end of highlighted area for 'showbreak',
// required when 'linebreak' is also set.
if (wlv->tocol == wlv->vcol)
@@ -829,7 +834,7 @@ wlv_screen_line(win_T *wp, winlinevars_T *wlv, int negative_width)
if (wp->w_p_nu && wp->w_p_rnu)
// Do not overwrite the line number, change "123 text" to
- // "123>>>xt".
+ // "123<<<xt".
while (skip < wp->w_width && VIM_ISDIGIT(ScreenLines[off]))
{
++off;
diff --git a/src/testdir/dumps/Test_visual_sbr_1.dump b/src/testdir/dumps/Test_visual_sbr_1.dump
new file mode 100644
index 0000000000..0a9511d38b
--- /dev/null
+++ b/src/testdir/dumps/Test_visual_sbr_1.dump
@@ -0,0 +1,6 @@
+|>+0#4040ff13#ffffff0| +0#0000000#e0e0e08|k|a|s|d| |g|u|b|e|r|g|r|e|n|,| |n|o| |s|e|a| |t|a|k|i|m|a|t|a| |s|a|n|c|t|u|s| |e|s|t| |L|o|r|e|m| |i|p|s|u|m| |d|o|l|o|r| |s|i|t| |a|m|e|t|.> +0&#ffffff0@1
+@75
+@75
+@75
+@75
+|-+2&&@1| |V|I|S|U|A|L| |-@1| +0&&@34|2|9|6| @6|1|,|2|9|6|-|2|9@1| @4|A|l@1|
diff --git a/src/testdir/test_highlight.vim b/src/testdir/test_highlight.vim
index a8ef8028b7..22d066fecb 100644
--- a/src/testdir/test_highlight.vim
+++ b/src/testdir/test_highlight.vim
@@ -753,6 +753,26 @@ func Test_colorcolumn_sbr()
call StopVimInTerminal(buf)
endfunc
+func Test_visual_sbr()
+ CheckScreendump
+
+ " check Visual highlight when 'showbreak' is set
+ let lines =<< trim END
+ set showbreak=>
+ call setline(1, 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.')
+ exe "normal! z1\<CR>"
+ END
+ call writefile(lines, 'Xtest_visual_sbr', 'D')
+ let buf = RunVimInTerminal('-S Xtest_visual_sbr', {'rows': 6,'columns': 60})
+
+ call term_sendkeys(buf, "v$")
+ call VerifyScreenDump(buf, 'Test_visual_sbr_1', {})
+
+ " clean up
+ call term_sendkeys(buf, "\<Esc>")
+ call StopVimInTerminal(buf)
+endfunc
+
" This test must come before the Test_cursorline test, as it appears this
" defines the Normal highlighting group anyway.
func Test_1_highlight_Normalgroup_exists()
diff --git a/src/version.c b/src/version.c
index fa900c1abf..6d65a6c8e2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1626,
+/**/
1625,
/**/
1624,