patch 8.2.2495: text jumps up and down when moving the cursor
Problem: Text jumps up and down when moving the cursor in a small window
with wrapping text and 'scrolloff' set.
Solution: Adjust the computation of w_skipcol. (partly by Ghjuvan Lacambre,
closes #7813)
diff --git a/src/move.c b/src/move.c
index aa90b52..d90e4d2 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1125,10 +1125,10 @@
n = curwin->w_wrow + so;
else
n = p_lines;
- if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width)
+ if ((colnr_T)n >= curwin->w_height + curwin->w_skipcol / width - so)
extra += 2;
- if (extra == 3 || p_lines < so * 2)
+ if (extra == 3 || p_lines <= so * 2)
{
// not enough room for 'scrolloff', put cursor in the middle
n = curwin->w_virtcol / width;