diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-03-13 07:46:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-13 07:46:11 +0100 |
commit | 2a8cef6bd450febd88d754e0c1909137b7451757 (patch) | |
tree | 73da66dcd1ba85b22d88b547b58f920039b167ad /src/nvim/api | |
parent | d5488633f68fcfd58b4bcad654ab103b4746204b (diff) | |
parent | 08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9 (diff) | |
download | rneovim-2a8cef6bd450febd88d754e0c1909137b7451757.tar.gz rneovim-2a8cef6bd450febd88d754e0c1909137b7451757.tar.bz2 rneovim-2a8cef6bd450febd88d754e0c1909137b7451757.zip |
Merge pull request #27815 from bfredl/setlines_scroll
fix(api/buffer): fix handling of viewport of non-current buffer
Diffstat (limited to 'src/nvim/api')
-rw-r--r-- | src/nvim/api/buffer.c | 11 | ||||
-rw-r--r-- | src/nvim/api/extmark.c | 4 | ||||
-rw-r--r-- | src/nvim/api/window.c | 4 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c index 035e36a2dd..42467d1562 100644 --- a/src/nvim/api/buffer.c +++ b/src/nvim/api/buffer.c @@ -1269,10 +1269,13 @@ static void fix_cursor(win_T *win, linenr_T lo, linenr_T hi, linenr_T extra) } else if (extra < 0) { check_cursor_lnum(win); } - check_cursor_col_win(win); + check_cursor_col(win); changed_cline_bef_curs(win); + win->w_valid &= ~(VALID_BOTLINE_AP); + update_topline(win); + } else { + invalidate_botline(win); } - invalidate_botline(win); } /// Fix cursor position after replacing text @@ -1307,7 +1310,7 @@ static void fix_cursor_cols(win_T *win, linenr_T start_row, colnr_T start_col, l // it's easier to work with a single value here. // col and coladd are fixed by a later call - // to check_cursor_col_win when necessary + // to check_cursor_col when necessary win->w_cursor.col += win->w_cursor.coladd; win->w_cursor.coladd = 0; @@ -1343,7 +1346,7 @@ static void fix_cursor_cols(win_T *win, linenr_T start_row, colnr_T start_col, l } } - check_cursor_col_win(win); + check_cursor_col(win); changed_cline_bef_curs(win); invalidate_botline(win); } diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c index a21cf5b337..b5f56d270c 100644 --- a/src/nvim/api/extmark.c +++ b/src/nvim/api/extmark.c @@ -1246,7 +1246,7 @@ Boolean nvim_win_add_ns(Window window, Integer ns_id, Error *err) set_put(uint32_t, &win->w_ns_set, (uint32_t)ns_id); - changed_window_setting_win(win); + changed_window_setting(win); return true; } @@ -1291,7 +1291,7 @@ Boolean nvim_win_remove_ns(Window window, Integer ns_id, Error *err) set_del(uint32_t, &win->w_ns_set, (uint32_t)ns_id); - changed_window_setting_win(win); + changed_window_setting(win); return true; } diff --git a/src/nvim/api/window.c b/src/nvim/api/window.c index 1a80e9ea16..026d09d9a9 100644 --- a/src/nvim/api/window.c +++ b/src/nvim/api/window.c @@ -138,7 +138,7 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) win->w_cursor.col = (colnr_T)col; win->w_cursor.coladd = 0; // When column is out of range silently correct it. - check_cursor_col_win(win); + check_cursor_col(win); // Make sure we stick in this column. win->w_set_curswant = true; @@ -148,7 +148,7 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) switchwin_T switchwin; switch_win(&switchwin, win, NULL, true); update_topline(curwin); - validate_cursor(); + validate_cursor(curwin); restore_win(&switchwin, true); redraw_later(win, UPD_VALID); |