mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
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
This commit is contained in:
@@ -1192,7 +1192,7 @@ void ml_recover(bool checkext)
|
||||
ml_delete(curbuf->b_ml.ml_line_count, false);
|
||||
}
|
||||
curbuf->b_flags |= BF_RECOVERED;
|
||||
check_cursor();
|
||||
check_cursor(curwin);
|
||||
|
||||
recoverymode = false;
|
||||
if (got_int) {
|
||||
@@ -4076,14 +4076,14 @@ void goto_byte(int cnt)
|
||||
if (lnum < 1) { // past the end
|
||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||
curwin->w_curswant = MAXCOL;
|
||||
coladvance(MAXCOL);
|
||||
coladvance(curwin, MAXCOL);
|
||||
} else {
|
||||
curwin->w_cursor.lnum = lnum;
|
||||
curwin->w_cursor.col = (colnr_T)boff;
|
||||
curwin->w_cursor.coladd = 0;
|
||||
curwin->w_set_curswant = true;
|
||||
}
|
||||
check_cursor();
|
||||
check_cursor(curwin);
|
||||
|
||||
// Make sure the cursor is on the first byte of a multi-byte char.
|
||||
mb_adjust_cursor();
|
||||
|
Reference in New Issue
Block a user