diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-07-21 16:04:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-21 16:04:59 +0200 |
commit | cbb46ac4fa3d370759f6a061a06e752be7fc9984 (patch) | |
tree | ed32d927553ae0a7335eb75e2e36dd31166389f3 /src | |
parent | 5c2f8ccc00062a17f790a3a8a4481ef418cb43c1 (diff) | |
parent | 89f9f168a5c4317bcc71cb61e64a1dd63d17a377 (diff) | |
download | rneovim-cbb46ac4fa3d370759f6a061a06e752be7fc9984.tar.gz rneovim-cbb46ac4fa3d370759f6a061a06e752be7fc9984.tar.bz2 rneovim-cbb46ac4fa3d370759f6a061a06e752be7fc9984.zip |
Merge pull request #28873 from luukvbaal/redraw
fix(api): alloc and draw cursor window in nvim__redraw
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/vim.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 26dc223948..7a4aefc620 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -2393,10 +2393,6 @@ void nvim__redraw(Dict(redraw) *opts, Error *err) redraw_buf_range_later(rbuf, first, last); } - if (opts->cursor) { - setcursor_mayforce(win ? win : curwin, true); - } - bool flush = opts->flush; if (opts->tabline) { // Flush later in case tabline was just hidden or shown for the first time. @@ -2423,11 +2419,22 @@ void nvim__redraw(Dict(redraw) *opts, Error *err) } } - // Flush pending screen updates if "flush" or "clear" is true, or when - // redrawing a status component may have changed the grid dimensions. + win_T *cwin = win ? win : curwin; + // Allow moving cursor to recently opened window and make sure it is drawn #28868. + if (opts->cursor && (!cwin->w_grid.target || !cwin->w_grid.target->valid)) { + flush = true; + } + + // Redraw pending screen updates when explicitly requested or when determined + // that it is necessary to properly draw other requested components. if (flush && !cmdpreview) { update_screen(); } + + if (opts->cursor) { + setcursor_mayforce(cwin, true); + } + ui_flush(); RedrawingDisabled = save_rd; |