mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
Merge pull request #23862 from neovim/backport-23854-to-release-0.9
[Backport release-0.9] fix(column): don't overflow sign column with extmark signs
This commit is contained in:
@@ -417,7 +417,9 @@ 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;
|
||||||
}
|
}
|
||||||
sattrs[j] = sattrs[j - 1];
|
if (j < SIGN_SHOW_MAX) {
|
||||||
|
sattrs[j] = sattrs[j - 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (j < SIGN_SHOW_MAX) {
|
if (j < SIGN_SHOW_MAX) {
|
||||||
sattrs[j] = (SignTextAttrs) {
|
sattrs[j] = (SignTextAttrs) {
|
||||||
|
@@ -10,6 +10,7 @@ local expect_events = helpers.expect_events
|
|||||||
local meths = helpers.meths
|
local meths = helpers.meths
|
||||||
local curbufmeths = helpers.curbufmeths
|
local curbufmeths = helpers.curbufmeths
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
|
local assert_alive = helpers.assert_alive
|
||||||
|
|
||||||
describe('decorations providers', function()
|
describe('decorations providers', function()
|
||||||
local screen
|
local screen
|
||||||
@@ -80,7 +81,7 @@ describe('decorations providers', function()
|
|||||||
local ns2 = api.nvim_create_namespace "ns2"
|
local ns2 = api.nvim_create_namespace "ns2"
|
||||||
api.nvim_set_decoration_provider(ns2, {})
|
api.nvim_set_decoration_provider(ns2, {})
|
||||||
]])
|
]])
|
||||||
helpers.assert_alive()
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('leave a trace', function()
|
it('leave a trace', function()
|
||||||
@@ -1075,7 +1076,7 @@ end]]
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
helpers.assert_alive()
|
assert_alive()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('conceal #19007', function()
|
it('conceal #19007', function()
|
||||||
@@ -2282,8 +2283,8 @@ l5
|
|||||||
insert(example_text)
|
insert(example_text)
|
||||||
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})
|
||||||
@@ -2306,6 +2307,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.win_set_option(0, 'signcolumn', 'auto')
|
meths.win_set_option(0, 'signcolumn', 'auto')
|
||||||
|
Reference in New Issue
Block a user