Skip to content

Commit

Permalink
Merge pull request #19025 from neovim/extmark-conceal
Browse files Browse the repository at this point in the history
[Backport release-0.7] fix(decorations): nvim_buf_set_extmark breaks conceal (#19010)
  • Loading branch information
clason committed Jun 19, 2022
2 parents 38928b5 + 40e13c8 commit 7266150
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nvim/decoration.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void bufhl_add_hl_pos_offset(buf_T *buf, int src_id, int hl_id, lpos_T pos_start
void decor_redraw(buf_T *buf, int row1, int row2, Decoration *decor)
{
if (row2 >= row1) {
if (!decor || decor->hl_id || decor_has_sign(decor)) {
if (!decor || decor->hl_id || decor_has_sign(decor) || decor->conceal) {
redraw_buf_range_later(buf, row1+1, row2+1);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/nvim/extmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ void extmark_set(buf_T *buf, uint32_t ns_id, uint32_t *idp, int row, colnr_T col
if (decor) {
if (kv_size(decor->virt_text)
|| kv_size(decor->virt_lines)
|| decor->conceal
|| decor_has_sign(decor)) {
decor_full = true;
decor = xmemdup(decor, sizeof *decor);
Expand Down
15 changes: 15 additions & 0 deletions test/functional/ui/decorations_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ describe('extmark decorations', function()
[23] = {foreground = Screen.colors.Magenta1, background = Screen.colors.LightGrey};
[24] = {bold = true};
[25] = {background = Screen.colors.LightRed};
[26] = {background=Screen.colors.DarkGrey, foreground=Screen.colors.LightGrey};
}

ns = meths.create_namespace 'test'
Expand Down Expand Up @@ -819,6 +820,20 @@ end]]
]]}
helpers.assert_alive()
end)

it('conceal #19007', function()
screen:try_resize(50, 5)
insert('foo\n')
command('let &conceallevel=2')
meths.buf_set_extmark(0, ns, 0, 0, {end_col=0, end_row=2, conceal='X'})
screen:expect([[
{26:X} |
^ |
{1:~ }|
{1:~ }|
|
]])
end)
end)

describe('decorations: virtual lines', function()
Expand Down

0 comments on commit 7266150

Please sign in to comment.