patch 9.1.0815: "above" virtual text causes wrong 'colorcolumn' position
Commit: https://github.com/vim/vim/commit/91d26aa338224fd0370c75fac9dc062cdcd18470 Author: zeertzjq <zeert...@outlook.com> Date: Sun Oct 27 19:23:34 2024 +0100 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 <zeert...@outlook.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/drawline.c b/src/drawline.c index fd5d56b43..b49e65313 100644 --- a/src/drawline.c +++ b/src/drawline.c @@ -2263,7 +2263,7 @@ win_line( } if (above) - wlv.vcol_off_tp = wlv.n_extra; + wlv.vcol_off_tp = vim_strsize(wlv.p_extra); if (lcs_eol_one < 0 && wp->w_p_wrap diff --git a/src/testdir/dumps/Test_prop_multibyte_above_1.dump b/src/testdir/dumps/Test_prop_multibyte_above_1.dump new file mode 100644 index 000000000..d1e1d762c --- /dev/null +++ b/src/testdir/dumps/Test_prop_multibyte_above_1.dump @@ -0,0 +1,16 @@ +| +0#af5f00255#ffffff0@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@1|1| |1+0#0000000&@7| | +0&#ffd7d7255| +0&#ffffff0@45 +| +0#af5f00255&@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@1|2| | +0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45 +| +0#af5f00255&@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@1|3| |3+0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45 +| +0#af5f00255&@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@1|4| | +0#0000000&@8| +0&#ffd7d7255| +0&#ffffff0@45 +| +0#af5f00255&@3|…+0#0000001#ffff4012| +0#0000000#ffffff0@54 +| +0#af5f00255&@1|5| >5+0#0000000&@8|5+0&#ffd7d7255|5+0&#ffffff0| @44 +|~+0#4040ff13&| @58 +|~| @58 +|~| @58 +|~| @58 +|~| @58 +| +0#0000000&@41|5|,|1|-|5|7| @7|A|l@1| diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim index bbb911f95..bf561cae3 100644 --- a/src/testdir/test_textprop.vim +++ b/src/testdir/test_textprop.vim @@ -3203,6 +3203,27 @@ func Test_prop_with_text_above_below_empty() call StopVimInTerminal(buf) endfunc +func Test_prop_with_multibyte_above() + CheckRunVimInTerminal + + let lines =<< trim END + setlocal number colorcolumn=10 + call setline(1, ['11111111', '', '333333333', '', '55555555555']) + + let vt = 'test' + call prop_type_add(vt, {'highlight': 'ToDo'}) + for ln in range(1, line('$')) + call prop_add(ln, 0, {'type': vt, 'text': '…', 'text_align': 'above'}) + endfor + normal G + END + call writefile(lines, 'XscriptPropMultibyteAbove', 'D') + let buf = RunVimInTerminal('-S XscriptPropMultibyteAbove', #{rows: 16, cols: 60}) + call VerifyScreenDump(buf, 'Test_prop_multibyte_above_1', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_prop_with_multibyte_below() CheckRunVimInTerminal diff --git a/src/version.c b/src/version.c index aa05ea2c3..393106715 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 815, /**/ 814, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1t581c-00Bdk0-GD%40256bit.org.