fix(column): rebuild status column when sign column is invalidated (#22690)

* fix(column): rebuild status column when sign column is invalidated

Problem:    When implementing a custom sign column through
            `'statuscolumn'`, the status column is not properly rebuilt
            when the sign column width changes.
Solution:   Force a rebuild of the status column when the sign column
            width is invalidated.

* test(column): 'statuscolumn' has correct width when (un)placing signs
This commit is contained in:
luukvbaal
2023-03-18 12:44:44 +01:00
committed by GitHub
parent 8916669d50
commit 204a8b17c8
4 changed files with 63 additions and 4 deletions

View File

@@ -557,4 +557,40 @@ describe('statuscolumn', function()
|
]])
end)
it("has correct width with custom sign column when (un)placing signs", function()
screen:try_resize(screen._width, 6)
exec_lua([[
vim.cmd.norm('gg')
vim.o.signcolumn = 'no'
vim.fn.sign_define('sign', { text = 'ss' })
_G.StatusCol = function()
local s = vim.fn.sign_getplaced(1)[1].signs
local sign = ''
if #s > 0 then
sign = vim.v.lnum == 5 and 'ss' or ' '
end
return vim.v.lnum .. '%=' .. sign
end
vim.o.statuscolumn = "%!v:lua.StatusCol()"
vim.fn.sign_place(0, '', 'sign', 1, { lnum = 5 })
]])
screen:expect([[
1 ^aaaaa |
2 aaaaa |
3 aaaaa |
4 aaaaa |
5 ssaaaaa |
|
]])
command('sign unplace 1')
screen:expect([[
1 ^aaaaa |
2 aaaaa |
3 aaaaa |
4 aaaaa |
5 aaaaa |
|
]])
end)
end)