mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user