refactor: pass the window to get_(side)scrolloff_value

to less rely on curwin
This commit is contained in:
Matthieu Coudron
2020-12-23 16:21:10 +01:00
parent 5ce328df40
commit 4d9520ec86
7 changed files with 22 additions and 20 deletions

View File

@@ -7159,20 +7159,20 @@ dict_T *get_winbuf_options(const int bufopt)
/// Return the effective 'scrolloff' value for the current window, using the
/// global value when appropriate.
long get_scrolloff_value(void)
long get_scrolloff_value(win_T *wp)
{
// Disallow scrolloff in terminal-mode. #11915
if (State & TERM_FOCUS) {
return 0;
}
return curwin->w_p_so < 0 ? p_so : curwin->w_p_so;
return wp->w_p_so < 0 ? p_so : wp->w_p_so;
}
/// Return the effective 'sidescrolloff' value for the current window, using the
/// global value when appropriate.
long get_sidescrolloff_value(void)
long get_sidescrolloff_value(win_T *wp)
{
return curwin->w_p_siso < 0 ? p_siso : curwin->w_p_siso;
return wp->w_p_siso < 0 ? p_siso : wp->w_p_siso;
}
Dictionary get_vimoption(String name, Error *err)