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:
Luuk van Baal
2024-04-10 11:42:46 +02:00
parent 7b14eb543d
commit 037ea6e786
17 changed files with 540 additions and 31 deletions

View File

@ -62,7 +62,7 @@ function M.on_inlayhint(err, result, ctx, _)
if num_unprocessed == 0 then
client_hints[client_id] = {}
bufstate.version = ctx.version
api.nvim__buf_redraw_range(bufnr, 0, -1)
api.nvim__redraw({ buf = bufnr, valid = true })
return
end
@ -91,7 +91,7 @@ function M.on_inlayhint(err, result, ctx, _)
client_hints[client_id] = new_lnum_hints
bufstate.version = ctx.version
api.nvim__buf_redraw_range(bufnr, 0, -1)
api.nvim__redraw({ buf = bufnr, valid = true })
end
--- |lsp-handler| for the method `textDocument/inlayHint/refresh`
@ -224,7 +224,7 @@ local function clear(bufnr)
end
end
api.nvim_buf_clear_namespace(bufnr, namespace, 0, -1)
api.nvim__buf_redraw_range(bufnr, 0, -1)
api.nvim__redraw({ buf = bufnr, valid = true })
end
--- Disable inlay hints for a buffer