Skip to content

Commit 91d26aa

Browse files
zeertzjqchrisbra
authored andcommitted
patch 9.1.0815: "above" virtual text causes wrong 'colorcolumn' position
Problem: "above" virtual text causes wrong 'colorcolumn' position. (@matrdr) Solution: Use the number of cells instead of bytes for vcol_off_tp. (zeertzjq) fixes: #15946 closes: #15948 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent de79f91 commit 91d26aa

4 files changed

Lines changed: 40 additions & 1 deletion

File tree

src/drawline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ win_line(
22632263
}
22642264

22652265
if (above)
2266-
wlv.vcol_off_tp = wlv.n_extra;
2266+
wlv.vcol_off_tp = vim_strsize(wlv.p_extra);
22672267

22682268
if (lcs_eol_one < 0
22692269
&& wp->w_p_wrap
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
| +0#af5f00255#ffffff0@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54
2+
| +0#af5f00255&@1|1| |1+0#0000000&@7| | +0&#ffd7d7255| +0&#ffffff0@45
3+
| +0#af5f00255&@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54
4+
| +0#af5f00255&@1|2| | +0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45
5+
| +0#af5f00255&@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54
6+
| +0#af5f00255&@1|3| |3+0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45
7+
| +0#af5f00255&@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54
8+
| +0#af5f00255&@1|4| | +0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45
9+
| +0#af5f00255&@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54
10+
| +0#af5f00255&@1|5| >5+0#0000000&@8|5+0&#ffd7d7255|5+0&#ffffff0| @44
11+
|~+0#4040ff13&| @58
12+
|~| @58
13+
|~| @58
14+
|~| @58
15+
|~| @58
16+
| +0#0000000&@41|5|,|1|-|5|7| @7|A|l@1|

src/testdir/test_textprop.vim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3203,6 +3203,27 @@ func Test_prop_with_text_above_below_empty()
32033203
call StopVimInTerminal(buf)
32043204
endfunc
32053205

3206+
func Test_prop_with_multibyte_above()
3207+
CheckRunVimInTerminal
3208+
3209+
let lines =<< trim END
3210+
setlocal number colorcolumn=10
3211+
call setline(1, ['11111111', '', '333333333', '', '55555555555'])
3212+
3213+
let vt = 'test'
3214+
call prop_type_add(vt, {'highlight': 'ToDo'})
3215+
for ln in range(1, line('$'))
3216+
call prop_add(ln, 0, {'type': vt, 'text': '…', 'text_align': 'above'})
3217+
endfor
3218+
normal G
3219+
END
3220+
call writefile(lines, 'XscriptPropMultibyteAbove', 'D')
3221+
let buf = RunVimInTerminal('-S XscriptPropMultibyteAbove', #{rows: 16, cols: 60})
3222+
call VerifyScreenDump(buf, 'Test_prop_multibyte_above_1', {})
3223+
3224+
call StopVimInTerminal(buf)
3225+
endfunc
3226+
32063227
func Test_prop_with_multibyte_below()
32073228
CheckRunVimInTerminal
32083229

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
815,
707709
/**/
708710
814,
709711
/**/

0 commit comments

Comments
 (0)