mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
fix(ui): fix virtual text not displaying when two overlapping inlines (nowrap)
This commit is contained in:
parent
5547b16c40
commit
34d862942c
@ -1756,6 +1756,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
|
||||
extmark_attr = decor_redraw_col(wp, (colnr_T)v, wlv.off,
|
||||
selected, &decor_state);
|
||||
|
||||
while (true) {
|
||||
// we could already be inside an existing virt_line with multiple chunks
|
||||
if (!(virt_inline_i < kv_size(virt_inline))) {
|
||||
DecorState *state = &decor_state;
|
||||
@ -1818,9 +1819,14 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
|
||||
skipped_cells += virt_text_len;
|
||||
n_attr = 0;
|
||||
wlv.n_extra = 0;
|
||||
|
||||
// go to the start so the next virtual text chunk can be selected.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (wlv.n_extra == 0) {
|
||||
@ -3013,8 +3019,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
|
||||
}
|
||||
|
||||
// The skipped cells need to be accounted for in vcol.
|
||||
if (wlv.draw_state > WL_STC
|
||||
&& skipped_cells > 0) {
|
||||
if (wlv.draw_state > WL_STC && skipped_cells > 0) {
|
||||
wlv.vcol += skipped_cells;
|
||||
skipped_cells = 0;
|
||||
}
|
||||
|
@ -1956,6 +1956,33 @@ bbbbbbb]])
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('correctly draws when there are multiple overlapping virtual texts on the same line with nowrap', function()
|
||||
command('set nowrap')
|
||||
insert('a')
|
||||
meths.buf_set_extmark(0, ns, 0, 0,
|
||||
{ virt_text = { { string.rep('a', 55), 'Special' } }, virt_text_pos = 'inline' })
|
||||
meths.buf_set_extmark(0, ns, 0, 0,
|
||||
{ virt_text = { { string.rep('b', 55), 'Special' } }, virt_text_pos = 'inline' })
|
||||
feed('$')
|
||||
screen:expect { grid = [[
|
||||
{28:bbbbbbbbbbbbbbbbbbbbbbbbb}^a |
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
{1:~ }|
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('decorations: virtual lines', function()
|
||||
|
Loading…
Reference in New Issue
Block a user