0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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>
This commit is contained in:
Luuk van Baal
2024-04-02 20:49:45 +02:00
committed by Christian Brabandt
parent f1750ca0c2
commit cb204e688e
11 changed files with 212 additions and 96 deletions

View File

@@ -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);
}
/*