mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 02:34:59 -07:00
fix(column): check if signcolumn changed in all windows #31439
This commit is contained in:
parent
e56437cd48
commit
3cb1e825e6
@ -1516,10 +1516,12 @@ static void win_update(win_T *wp)
|
||||
|
||||
decor_providers_invoke_win(wp);
|
||||
|
||||
if (win_redraw_signcols(wp)) {
|
||||
wp->w_lines_valid = 0;
|
||||
wp->w_redr_type = UPD_NOT_VALID;
|
||||
changed_line_abv_curs_win(wp);
|
||||
FOR_ALL_WINDOWS_IN_TAB(win, curtab) {
|
||||
if (win->w_buffer == wp->w_buffer && win_redraw_signcols(win)) {
|
||||
win->w_lines_valid = 0;
|
||||
changed_line_abv_curs_win(win);
|
||||
redraw_later(win, UPD_NOT_VALID);
|
||||
}
|
||||
}
|
||||
|
||||
init_search_hl(wp, &screen_search_hl);
|
||||
|
@ -607,4 +607,77 @@ describe('Signs', function()
|
||||
eq(6, infos[1].textoff)
|
||||
eq(6, infos[2].textoff)
|
||||
end)
|
||||
|
||||
it('auto width updated in all windows after sign placed in on_win #31438', function()
|
||||
exec_lua([[
|
||||
vim.cmd.call('setline(1, range(1, 500))')
|
||||
vim.cmd('wincmd s | wincmd v | wincmd j | wincmd v')
|
||||
|
||||
_G.log, _G.needs_clear = {}, false
|
||||
local ns_id, mark_id = vim.api.nvim_create_namespace('test'), nil
|
||||
|
||||
-- Add decoration which possibly clears all extmarks and adds one on line 499
|
||||
local on_win = function(_, winid, bufnr, toprow, botrow)
|
||||
if _G.needs_clear then
|
||||
vim.api.nvim_buf_clear_namespace(bufnr, ns_id, 0, -1)
|
||||
_G.needs_clear = false
|
||||
end
|
||||
|
||||
if toprow < 499 and 499 <= botrow then
|
||||
mark_id = vim.api.nvim_buf_set_extmark(bufnr, ns_id, 499, 0, { id = mark_id, sign_text = '!', invalidate = true })
|
||||
end
|
||||
end
|
||||
vim.api.nvim_set_decoration_provider(ns_id, { on_win = on_win })
|
||||
]])
|
||||
screen:expect([[
|
||||
1 │1 |
|
||||
2 │2 |
|
||||
3 │3 |
|
||||
4 │4 |
|
||||
5 │5 |
|
||||
6 │6 |
|
||||
{2:[No Name] [+] [No Name] [+] }|
|
||||
^1 │1 |
|
||||
2 │2 |
|
||||
3 │3 |
|
||||
4 │4 |
|
||||
5 │5 |
|
||||
{3:[No Name] [+] }{2:[No Name] [+] }|
|
||||
|
|
||||
]])
|
||||
feed('G')
|
||||
screen:expect([[
|
||||
{7: }1 │{7: }1 |
|
||||
{7: }2 │{7: }2 |
|
||||
{7: }3 │{7: }3 |
|
||||
{7: }4 │{7: }4 |
|
||||
{7: }5 │{7: }5 |
|
||||
{7: }6 │{7: }6 |
|
||||
{2:[No Name] [+] [No Name] [+] }|
|
||||
{7: }496 │{7: }1 |
|
||||
{7: }497 │{7: }2 |
|
||||
{7: }498 │{7: }3 |
|
||||
{7: }499 │{7: }4 |
|
||||
! ^500 │{7: }5 |
|
||||
{3:[No Name] [+] }{2:[No Name] [+] }|
|
||||
|
|
||||
]])
|
||||
feed(':lua log, needs_clear = {}, true<CR>')
|
||||
screen:expect([[
|
||||
{7: }1 │{7: }1 |
|
||||
{7: }2 │{7: }2 |
|
||||
{7: }3 │{7: }3 |
|
||||
{7: }4 │{7: }4 |
|
||||
{7: }5 │{7: }5 |
|
||||
{7: }6 │{7: }6 |
|
||||
{2:[No Name] [+] [No Name] [+] }|
|
||||
{7: }496 │{7: }1 |
|
||||
{7: }497 │{7: }2 |
|
||||
{7: }498 │{7: }3 |
|
||||
{7: }499 │{7: }4 |
|
||||
! ^500 │{7: }5 |
|
||||
{3:[No Name] [+] }{2:[No Name] [+] }|
|
||||
:lua log, needs_clear = {}, true |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user