fix(options): 'scrolloffpad' reads the wrong window #41684

Problem:
`get_scrolloffpad_value()` takes a window, but its else branch reads
`curwin->w_p_sop` instead of `wp->w_p_sop`.

Reachable from Vimscript, since `line('w0', winid)` runs
`update_topline()` on another window without making it current.

Solution:
Read the option from the window that was passed in.

AI-assisted
This commit is contained in:
Volodymyr Chernetskyi
2026-09-05 19:36:14 +02:00
committed by GitHub
parent 455b6a810c
commit 050fa30632
2 changed files with 18 additions and 1 deletions

View File

@@ -7151,7 +7151,7 @@ int64_t get_scrolloff_value(win_T *wp)
/// global value when appropriate.
int64_t get_scrolloffpad_value(win_T *wp)
{
return wp->w_p_sop == -1 ? p_sop : curwin->w_p_sop;
return wp->w_p_sop == -1 ? p_sop : wp->w_p_sop;
}
/// Return the effective 'sidescrolloff' value for the current window, using the