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:
@@ -1432,7 +1432,7 @@ win_found:
|
||||
|
||||
// the buffer contents may have changed
|
||||
VIsual_active = aco->save_VIsual_active;
|
||||
check_cursor();
|
||||
check_cursor(curwin);
|
||||
if (curwin->w_topline > curbuf->b_ml.ml_line_count) {
|
||||
curwin->w_topline = curbuf->b_ml.ml_line_count;
|
||||
curwin->w_topfill = 0;
|
||||
@@ -1464,12 +1464,12 @@ win_found:
|
||||
// In case the autocommand moves the cursor to a position that does not
|
||||
// exist in curbuf
|
||||
VIsual_active = aco->save_VIsual_active;
|
||||
check_cursor();
|
||||
check_cursor(curwin);
|
||||
}
|
||||
}
|
||||
|
||||
VIsual_active = aco->save_VIsual_active;
|
||||
check_cursor(); // just in case lines got deleted
|
||||
check_cursor(curwin); // just in case lines got deleted
|
||||
if (VIsual_active) {
|
||||
check_pos(curbuf, &VIsual);
|
||||
}
|
||||
|
Reference in New Issue
Block a user