Skip to content

Commit

Permalink
fix(extmarks): redraw line on adding/removing conceal (neovim#27463)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeertzjq authored Feb 13, 2024
1 parent b2f7a3a commit a376d97
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/nvim/decoration.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ void decor_redraw(buf_T *buf, int row1, int row2, int col1, DecorInline decor)

void decor_redraw_sh(buf_T *buf, int row1, int row2, DecorSignHighlight sh)
{
if (sh.hl_id || (sh.url != NULL) || (sh.flags & (kSHIsSign|kSHSpellOn|kSHSpellOff))) {
if (sh.hl_id || (sh.url != NULL)
|| (sh.flags & (kSHIsSign | kSHSpellOn | kSHSpellOff | kSHConceal))) {
if (row2 >= row1) {
redraw_buf_range_later(buf, row1 + 1, row2 + 1);
}
Expand Down
29 changes: 29 additions & 0 deletions test/functional/ui/decorations_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,35 @@ describe('extmark decorations', function()
]]}
end)

it('redraws properly when adding/removing conceal on non-current line', function()
screen:try_resize(50, 5)
api.nvim_buf_set_lines(0, 0, -1, true, {'abcd', 'efgh','ijkl', 'mnop'})
command('setlocal conceallevel=2')
screen:expect{grid=[[
^abcd |
efgh |
ijkl |
mnop |
|
]]}
api.nvim_buf_set_extmark(0, ns, 2, 1, {end_col=3, conceal=''})
screen:expect{grid=[[
^abcd |
efgh |
il |
mnop |
|
]]}
api.nvim_buf_clear_namespace(0, ns, 0, -1)
screen:expect{grid=[[
^abcd |
efgh |
ijkl |
mnop |
|
]]}
end)

it('avoids redraw issue #20651', function()
exec_lua[[
vim.cmd.normal'10oXXX'
Expand Down

0 comments on commit a376d97

Please sign in to comment.