summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-09 18:14:12 +0100
committerChristian Brabandt <cb@256bit.org>2024-02-09 18:14:12 +0100
commitdf23d7f4bd7546f3152ea003856525591218565b (patch)
treeef204d9b58b04f012e4d4d7c6e804de657588fec
parentae07ebc04b0726e12b1af39d52e01d86ae79ef0a (diff)
patch 9.1.0084: Visual hl wrong when it ends before multibyte 'showbreak'v9.1.0084
Problem: Visual hl wrong when it ends before multibyte 'showbreak'. (lacygoil) Solution: Use vcol_sbr instead of adding n_extra. (zeertzjq) fixes: #11272 closes: #13996 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/drawline.c2
-rw-r--r--src/testdir/dumps/Test_visual_ends_before_showbreak.dump6
-rw-r--r--src/testdir/test_listlbr_utf8.vim21
-rw-r--r--src/version.c2
4 files changed, 30 insertions, 1 deletions
diff --git a/src/drawline.c b/src/drawline.c
index f6c01d5973..0f3400f9da 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -589,7 +589,7 @@ handle_showbreak_and_filler(win_T *wp, winlinevars_T *wlv)
// Correct end of highlighted area for 'showbreak',
// required when 'linebreak' is also set.
if (wlv->tocol == wlv->vcol)
- wlv->tocol += wlv->n_extra;
+ wlv->tocol = wlv->vcol_sbr;
// combine 'showbreak' with 'wincolor'
wlv->char_attr = hl_combine_attr(wlv->win_attr, HL_ATTR(HLF_AT));
# ifdef FEAT_SYN_HL
diff --git a/src/testdir/dumps/Test_visual_ends_before_showbreak.dump b/src/testdir/dumps/Test_visual_ends_before_showbreak.dump
new file mode 100644
index 0000000000..ee809bab5e
--- /dev/null
+++ b/src/testdir/dumps/Test_visual_ends_before_showbreak.dump
@@ -0,0 +1,6 @@
+|x+0&#ffffff0@4| @69
+|↪+0#4040ff13&| |y+0#0000001#a8a8a8255@68> +0#0000000#ffffff0| +0#0000001#a8a8a8255@2
+|↪+0#4040ff13#ffffff0| |z+0#0000000&@3| @68
+|~+0#4040ff13&| @73
+|~| @73
+|-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@34|7|0| @7|1|,|7|6|-|1|4|7| @5|A|l@1|
diff --git a/src/testdir/test_listlbr_utf8.vim b/src/testdir/test_listlbr_utf8.vim
index 1bbbd2d2ae..313ff30cc4 100644
--- a/src/testdir/test_listlbr_utf8.vim
+++ b/src/testdir/test_listlbr_utf8.vim
@@ -9,6 +9,7 @@ CheckFeature conceal
CheckFeature signs
source view_util.vim
+source screendump.vim
func s:screen_lines(lnum, width) abort
return ScreenLines(a:lnum, a:width)
@@ -358,4 +359,24 @@ func Test_unprintable_char_on_wrap_column()
call s:close_windows()
endfunc
+" Test that Visual selection is drawn correctly when 'linebreak' is set and
+" selection ends before multibyte 'showbreak'.
+func Test_visual_ends_before_showbreak()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ &wrap = true
+ &linebreak = true
+ &showbreak = '↪ '
+ ['xxxxx ' .. 'y'->repeat(&columns - 6) .. ' zzzz']->setline(1)
+ normal! wvel
+ END
+ call writefile(lines, 'XvisualEndsBeforeShowbreak', 'D')
+ let buf = RunVimInTerminal('-S XvisualEndsBeforeShowbreak', #{rows: 6})
+ call VerifyScreenDump(buf, 'Test_visual_ends_before_showbreak', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index e0f30f2322..d961085f66 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 84,
+/**/
83,
/**/
82,