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:
bfredl
2024-03-11 13:19:49 +01:00
parent d5488633f6
commit 08fc1ebbaa
50 changed files with 844 additions and 814 deletions

View File

@@ -1937,7 +1937,7 @@ static const char *did_set_arabic(optset_T *args)
// set rightleft mode
if (!win->w_p_rl) {
win->w_p_rl = true;
changed_window_setting();
changed_window_setting(curwin);
}
// Enable Arabic shaping (major part of what Arabic requires)
@@ -1968,7 +1968,7 @@ static const char *did_set_arabic(optset_T *args)
// reset rightleft mode
if (win->w_p_rl) {
win->w_p_rl = false;
changed_window_setting();
changed_window_setting(curwin);
}
// 'arabicshape' isn't reset, it is a global option and
@@ -3029,7 +3029,7 @@ void check_redraw_for(buf_T *buf, win_T *win, uint32_t flags)
if (flags & P_HLONLY) {
redraw_later(win, UPD_NOT_VALID);
} else {
changed_window_setting_win(win);
changed_window_setting(win);
}
}
if (flags & P_RBUF) {
@@ -6104,9 +6104,9 @@ char *get_flp_value(buf_T *buf)
}
/// Get the local or global value of the 'virtualedit' flags.
unsigned get_ve_flags(void)
unsigned get_ve_flags(win_T *wp)
{
return (curwin->w_ve_flags ? curwin->w_ve_flags : ve_flags) & ~(VE_NONE | VE_NONEU);
return (wp->w_ve_flags ? wp->w_ve_flags : ve_flags) & ~(VE_NONE | VE_NONEU);
}
/// Get the local or global value of 'showbreak'.