diff options
Diffstat (limited to 'src/normal.c')
-rw-r--r-- | src/normal.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/normal.c b/src/normal.c index 83b74ccc69..955cd365a2 100644 --- a/src/normal.c +++ b/src/normal.c @@ -2303,7 +2303,7 @@ find_decl( * * 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 @@ nv_gv_cmd(cmdarg_T *cap) * "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 @@ nv_g_home_m_cmd(cmdarg_T *cap) 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 @@ nv_at(cmdarg_T *cap) 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); } /* |