mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(decoration): don't show signcolumn for non-sign_text extmark (#22135)
Fixes: #22127
This commit is contained in:
parent
7963a160e9
commit
228684d2fb
@ -838,6 +838,7 @@ struct file_buffer {
|
||||
Map(uint32_t, uint32_t) b_extmark_ns[1]; // extmark namespaces
|
||||
size_t b_virt_line_blocks; // number of virt_line blocks
|
||||
size_t b_signs; // number of sign extmarks
|
||||
size_t b_signs_with_text; // number of sign extmarks with text
|
||||
|
||||
// array of channel_id:s which have asked to receive updates for this
|
||||
// buffer.
|
||||
|
@ -100,9 +100,13 @@ void decor_remove(buf_T *buf, int row, int row2, Decoration *decor)
|
||||
if (decor_has_sign(decor)) {
|
||||
assert(buf->b_signs > 0);
|
||||
buf->b_signs--;
|
||||
}
|
||||
if (row2 >= row && decor->sign_text) {
|
||||
buf_signcols_del_check(buf, row + 1, row2 + 1);
|
||||
if (decor->sign_text) {
|
||||
assert(buf->b_signs_with_text > 0);
|
||||
buf->b_signs_with_text--;
|
||||
if (row2 >= row) {
|
||||
buf_signcols_del_check(buf, row + 1, row2 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
decor_free(decor);
|
||||
@ -445,11 +449,11 @@ int decor_signcols(buf_T *buf, DecorState *state, int row, int end_row, int max)
|
||||
int signcols = 0; // highest value of count
|
||||
int currow = -1; // current row
|
||||
|
||||
if (max <= 1 && buf->b_signs >= (size_t)max) {
|
||||
if (max <= 1 && buf->b_signs_with_text >= (size_t)max) {
|
||||
return max;
|
||||
}
|
||||
|
||||
if (buf->b_signs == 0) {
|
||||
if (buf->b_signs_with_text == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,7 @@ revised:
|
||||
buf->b_signs++;
|
||||
}
|
||||
if (decor->sign_text) {
|
||||
buf->b_signs_with_text++;
|
||||
// TODO(lewis6991): smarter invalidation
|
||||
buf_signcols_add_check(buf, NULL);
|
||||
}
|
||||
|
@ -2109,6 +2109,20 @@ l5
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
it('does not set signcolumn for signs without text', function()
|
||||
screen:try_resize(20, 3)
|
||||
meths.win_set_option(0, 'signcolumn', 'auto')
|
||||
insert(example_text)
|
||||
feed 'gg'
|
||||
meths.buf_set_extmark(0, ns, 0, -1, {number_hl_group='Error'})
|
||||
screen:expect{grid=[[
|
||||
^l1 |
|
||||
l2 |
|
||||
|
|
||||
]]}
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
describe('decorations: virt_text', function()
|
||||
|
Loading…
Reference in New Issue
Block a user