patch 9.1.0258: half-page scrolling broke backward compatibility
Problem: Support for 'smoothscroll' in (half-)page scrolling
broke backward compatibility and can be made to work better.
(after v9.1.215)
Solution: Restore the previous cursor and end-of-buffer behavior for
half-page scrolling and improve 'smoothscroll' support.
(Luuk van Baal)
fixes: #14338
closes: #14377
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/normal.c b/src/normal.c
index 83b74cc..955cd36 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -2303,7 +2303,7 @@
*
* Return OK if able to move cursor, FAIL otherwise.
*/
- static int
+ int
nv_screengo(oparg_T *oap, int dir, long dist)
{
@@ -5745,7 +5745,7 @@
* "g0", "g^" : Like "0" and "^" but for screen lines.
* "gm": middle of "g0" and "g$".
*/
- static void
+ void
nv_g_home_m_cmd(cmdarg_T *cap)
{
int i;
@@ -5771,6 +5771,15 @@
i = 0;
if (virtcol >= (colnr_T)width1 && width2 > 0)
i = (virtcol - width1) / width2 * width2 + width1;
+
+ // When ending up below 'smoothscroll' marker, move just beyond it so
+ // that skipcol is not adjusted later.
+ if (curwin->w_skipcol > 0 && curwin->w_cursor.lnum == curwin->w_topline)
+ {
+ int overlap = sms_marker_overlap(curwin, -1);
+ if (overlap > 0 && i == curwin->w_skipcol)
+ i += overlap;
+ }
}
else
i = curwin->w_leftcol;
@@ -7263,8 +7272,9 @@
static void
nv_halfpage(cmdarg_T *cap)
{
+ int dir = cap->cmdchar == Ctrl_D ? FORWARD : BACKWARD;
if (!checkclearop(cap->oap))
- pagescroll(cap->cmdchar == Ctrl_D, cap->count0, TRUE);
+ pagescroll(dir, cap->count0, TRUE);
}
/*