patch 9.1.1388: Scrolling one line too far with 'nosmoothscroll' page scrolling
Problem: One-off error in "count" to make "w_skipcol" zero with
'nosmoothscroll' page scrolling when last virtual line
in a buffer line is exactly the entire window width.
(Hirohito Higashi)
Solution: Properly compute the smallest integer value necessary
to make "w_skipcol" zero (Luuk van Baal)
fixes: #17317
closes: #17318
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/move.c b/src/move.c
index 1c1edde..e3771a5 100644
--- a/src/move.c
+++ b/src/move.c
@@ -3215,10 +3215,10 @@
int width1 = curwin->w_width - curwin_col_off();
int width2 = width1 + curwin_col_off2();
- count = 1 + (curwin->w_skipcol - width1) / width2;
+ count = 1 + (curwin->w_skipcol - width1 - 1) / width2;
if (fixdir == FORWARD)
- count = 2 + (linetabsize_eol(curwin, curwin->w_topline)
- - curwin->w_skipcol - width1) / width2;
+ count = 1 + (linetabsize_eol(curwin, curwin->w_topline)
+ - curwin->w_skipcol - width1 + width2 - 1) / width2;
scroll_redraw(fixdir == FORWARD, count);
*curscount += count * (fixdir == dir ? 1 : -1);
}