diff options
author | Jlll1 <arghantentua@tutanota.com> | 2022-11-17 00:18:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-17 07:18:31 +0800 |
commit | fedf002cb34d0d7a50c54f84a2f161984db2a4c2 (patch) | |
tree | 5d8e0d5af7cc1821f219fef1029f93bddb833eb3 /src | |
parent | c404f9b4baf57b946d4dd8d00fce5225e2b5131b (diff) | |
download | rneovim-fedf002cb34d0d7a50c54f84a2f161984db2a4c2.tar.gz rneovim-fedf002cb34d0d7a50c54f84a2f161984db2a4c2.tar.bz2 rneovim-fedf002cb34d0d7a50c54f84a2f161984db2a4c2.zip |
fix(api): nvim_win_set_cursor redraw cursorcolumn for non-current window (#21072)
fix #19063
this fixes the cursorcolumn not being redrawn for non-current windows in `nvim_win_set_cursor()`
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/window.c | 9 | ||||
-rw-r--r-- | src/nvim/move.c | 9 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 3f7c734cd1..8d17570077 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -118,8 +118,13 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) // Make sure we stick in this column. win->w_set_curswant = true; - // make sure cursor is in visible range even if win != curwin - update_topline_win(win); + // make sure cursor is in visible range and + // cursorcolumn and cursorline are updated even if win != curwin + switchwin_T switchwin; + switch_win(&switchwin, win, NULL, true); + update_topline(curwin); + validate_cursor(); + restore_win(&switchwin, true); redraw_later(win, UPD_VALID); win->w_redr_status = true; diff --git a/src/nvim/move.c b/src/nvim/move.c index df79b169b8..25d27d154b 100644 --- a/src/nvim/move.c +++ b/src/nvim/move.c @@ -341,15 +341,6 @@ void update_topline(win_T *wp) *so_ptr = save_so; } -// Update win->w_topline to move the cursor onto the screen. -void update_topline_win(win_T *win) -{ - switchwin_T switchwin; - switch_win(&switchwin, win, NULL, true); - update_topline(curwin); - restore_win(&switchwin, true); -} - // Return the scrolljump value to use for the current window. // When 'scrolljump' is positive use it as-is. // When 'scrolljump' is negative use it as a percentage of the window height. |