mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
fix(extmarks): blending space shouldn't overwrite wide char (#26960)
This commit is contained in:
parent
b2c92eebc0
commit
d54156ed08
@ -337,7 +337,7 @@ static int draw_virt_text_item(buf_T *buf, int col, VirtText vt, HlMode hl_mode,
|
||||
schar_T dummy[2] = { schar_from_ascii(' '), schar_from_ascii(' ') };
|
||||
int maxcells = max_col - col;
|
||||
// When overwriting the right half of a double-width char, clear the left half.
|
||||
if (linebuf_char[col] == 0) {
|
||||
if (!through && linebuf_char[col] == 0) {
|
||||
assert(col > 0);
|
||||
linebuf_char[col - 1] = schar_from_ascii(' ');
|
||||
// Clear the right half as well for the assertion in line_putchar().
|
||||
|
@ -2112,6 +2112,43 @@ describe('extmark decorations', function()
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('virtual text blending space does not overwrite double-width char', function()
|
||||
screen:try_resize(50, 3)
|
||||
insert('abcdefghij口klmnopqrstu口vwx口yz')
|
||||
feed('0')
|
||||
command('hi Blendy guibg=Red blend=30')
|
||||
meths.buf_set_extmark(0, ns, 0, 0, { virt_text = {{' ! ! ', 'Blendy'}}, virt_text_win_col = 8, hl_mode = 'blend' })
|
||||
screen:expect{grid=[[
|
||||
^abcdefgh{10:i}{7:!}{10:口}{7:!}{10:l}mnopqrstu口vwx口yz |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
feed('x')
|
||||
screen:expect{grid=[[
|
||||
^bcdefghi{10:j}{7:!}{10: k}{7:!}{10:m}nopqrstu口vwx口yz |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
feed('x')
|
||||
screen:expect{grid=[[
|
||||
^cdefghij{10: }{7:!}{10:kl}{7:!}{10:n}opqrstu口vwx口yz |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
feed('x')
|
||||
screen:expect{grid=[[
|
||||
^defghij口{7:!}{10:lm}{7:!}{10:o}pqrstu口vwx口yz |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
feed('7x')
|
||||
screen:expect{grid=[[
|
||||
^口klmnop{10:q}{7:!}{10:st}{7:!}{10:口}vwx口yz |
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('virtual text works with double-width char and rightleft', function()
|
||||
screen:try_resize(50, 3)
|
||||
insert('abcdefghij口klmnopqrstu口vwx口yz')
|
||||
|
Loading…
Reference in New Issue
Block a user