mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
feat(api): add nvim__redraw for more granular redrawing
Experimental and subject to future changes. Add a way to redraw certain elements that are not redrawn while Nvim is waiting for input, or currently have no API to do so. This API covers all that can be done with the :redraw* commands, in addition to the following new features: - Immediately move the cursor to a (non-current) window. - Target a specific window or buffer to mark for redraw. - Mark a buffer range for redraw (replaces nvim__buf_redraw_range()). - Redraw the 'statuscolumn'.
This commit is contained in:
@@ -918,4 +918,57 @@ describe('statuscolumn', function()
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('forces a rebuild with nvim__redraw', function()
|
||||
screen:try_resize(40, 4)
|
||||
-- Current window
|
||||
command([[
|
||||
let g:insert = v:false
|
||||
set nonu stc=%{g:insert?'insert':''}
|
||||
vsplit
|
||||
au InsertEnter * let g:insert = v:true | call nvim__redraw(#{statuscolumn:1, win:0})
|
||||
au InsertLeave * let g:insert = v:false | call nvim__redraw(#{statuscolumn:1, win:0})
|
||||
]])
|
||||
feed('i')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
{8:insert}^aaaaa │aaaaa |
|
||||
{8:insert}aaaaa │aaaaa |
|
||||
{3:[No Name] [+] }{2:[No Name] [+] }|
|
||||
{5:-- INSERT --} |
|
||||
]],
|
||||
})
|
||||
feed('<esc>')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
^aaaaa │aaaaa |
|
||||
aaaaa │aaaaa |
|
||||
{3:[No Name] [+] }{2:[No Name] [+] }|
|
||||
|
|
||||
]],
|
||||
})
|
||||
-- All windows
|
||||
command([[
|
||||
au! InsertEnter * let g:insert = v:true | call nvim__redraw(#{statuscolumn:1})
|
||||
au! InsertLeave * let g:insert = v:false | call nvim__redraw(#{statuscolumn:1})
|
||||
]])
|
||||
feed('i')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
{8:insert}^aaaaa │{8:insert}aaaaa |
|
||||
{8:insert}aaaaa │{8:insert}aaaaa |
|
||||
{3:[No Name] [+] }{2:[No Name] [+] }|
|
||||
{5:-- INSERT --} |
|
||||
]],
|
||||
})
|
||||
feed('<esc>')
|
||||
screen:expect({
|
||||
grid = [[
|
||||
^aaaaa │aaaaa |
|
||||
aaaaa │aaaaa |
|
||||
{3:[No Name] [+] }{2:[No Name] [+] }|
|
||||
|
|
||||
]],
|
||||
})
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user