mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(column): don't overflow sign column with extmark signs
This commit is contained in:
@@ -433,8 +433,10 @@ void decor_redraw_signs(buf_T *buf, int row, int *num_signs, SignTextAttrs sattr
|
|||||||
if (sattrs[j - 1].priority >= decor->priority) {
|
if (sattrs[j - 1].priority >= decor->priority) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (j < SIGN_SHOW_MAX) {
|
||||||
sattrs[j] = sattrs[j - 1];
|
sattrs[j] = sattrs[j - 1];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (j < SIGN_SHOW_MAX) {
|
if (j < SIGN_SHOW_MAX) {
|
||||||
sattrs[j] = (SignTextAttrs) {
|
sattrs[j] = (SignTextAttrs) {
|
||||||
.text = decor->sign_text,
|
.text = decor->sign_text,
|
||||||
|
@@ -3342,8 +3342,8 @@ l5
|
|||||||
insert(example_test3)
|
insert(example_test3)
|
||||||
feed 'gg'
|
feed 'gg'
|
||||||
|
|
||||||
helpers.command('sign define Oldsign text=O3')
|
command('sign define Oldsign text=O3')
|
||||||
helpers.command([[exe 'sign place 42 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
command([[exe 'sign place 42 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
|
||||||
meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S4', priority=100})
|
meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S4', priority=100})
|
||||||
meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S2', priority=5})
|
meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S2', priority=5})
|
||||||
@@ -3366,6 +3366,39 @@ l5
|
|||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('does not overflow with many old signs #23852', function()
|
||||||
|
screen:try_resize(20, 3)
|
||||||
|
|
||||||
|
command('set signcolumn:auto:9')
|
||||||
|
command('sign define Oldsign text=O3')
|
||||||
|
command([[exe 'sign place 01 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
command([[exe 'sign place 02 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
command([[exe 'sign place 03 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
command([[exe 'sign place 04 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
command([[exe 'sign place 05 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
command([[exe 'sign place 06 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
command([[exe 'sign place 07 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
command([[exe 'sign place 08 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
command([[exe 'sign place 09 line=1 name=Oldsign priority=10 buffer=' . bufnr('')]])
|
||||||
|
screen:expect{grid=[[
|
||||||
|
O3O3O3O3O3O3O3O3O3^ |
|
||||||
|
{2:~ }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S1', priority=1})
|
||||||
|
screen:expect_unchanged()
|
||||||
|
|
||||||
|
meths.buf_set_extmark(0, ns, 0, -1, {sign_text='S5', priority=200})
|
||||||
|
screen:expect{grid=[[
|
||||||
|
O3O3O3O3O3O3O3O3S5^ |
|
||||||
|
{2:~ }|
|
||||||
|
|
|
||||||
|
]]}
|
||||||
|
|
||||||
|
assert_alive()
|
||||||
|
end)
|
||||||
|
|
||||||
it('does not set signcolumn for signs without text', function()
|
it('does not set signcolumn for signs without text', function()
|
||||||
screen:try_resize(20, 3)
|
screen:try_resize(20, 3)
|
||||||
meths.set_option_value('signcolumn', 'auto', {})
|
meths.set_option_value('signcolumn', 'auto', {})
|
||||||
|
Reference in New Issue
Block a user