diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-03-11 13:19:49 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-03-13 07:19:59 +0100 |
commit | 08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9 (patch) | |
tree | 73da66dcd1ba85b22d88b547b58f920039b167ad /src/nvim/buffer.c | |
parent | d5488633f68fcfd58b4bcad654ab103b4746204b (diff) | |
download | rneovim-08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9.tar.gz rneovim-08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9.tar.bz2 rneovim-08fc1ebbaa49e3110b65bddeed28d2e61a96f5d9.zip |
fix(api/buffer): fix handling of viewport of non-current buffer
A lot of functions in move.c only worked for curwin, alternatively
took a `wp` arg but still only work if that happens to be curwin.
Refactor those that are needed for update_topline(wp) to work
for any window.
fixes #27723
fixes #27720
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index e141706edd..3c2d52e6ad 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -1752,7 +1752,7 @@ void enter_buffer(buf_T *buf) maketitle(); // when autocmds didn't change it if (curwin->w_topline == 1 && !curwin->w_topline_was_set) { - scroll_cursor_halfway(false, false); // redisplay at correct position + scroll_cursor_halfway(curwin, false, false); // redisplay at correct position } // Change directories when the 'acd' option is set. @@ -2172,7 +2172,7 @@ int buflist_getfile(int n, linenr_T lnum, int options, int forceit) // cursor is at to BOL and w_cursor.lnum is checked due to getfile() if (!p_sol && col != 0) { curwin->w_cursor.col = col; - check_cursor_col(); + check_cursor_col(curwin); curwin->w_cursor.coladd = 0; curwin->w_set_curswant = true; } @@ -2197,7 +2197,7 @@ void buflist_getfpos(void) curwin->w_cursor.col = 0; } else { curwin->w_cursor.col = fpos->col; - check_cursor_col(); + check_cursor_col(curwin); curwin->w_cursor.coladd = 0; curwin->w_set_curswant = true; } @@ -3257,7 +3257,7 @@ void fileinfo(int fullname, int shorthelp, bool dont_truncate) (int64_t)curwin->w_cursor.lnum, (int64_t)curbuf->b_ml.ml_line_count, n); - validate_virtcol(); + validate_virtcol(curwin); size_t len = strlen(buffer); col_print(buffer + len, IOSIZE - len, (int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1); |