mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-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)
cb204e688e
This commit is contained in:
@@ -2460,7 +2460,7 @@ bool find_decl(char *ptr, size_t len, bool locally, bool thisblock, int flags_ar
|
||||
/// 'dist' must be positive.
|
||||
///
|
||||
/// @return true if able to move cursor, false otherwise.
|
||||
static bool nv_screengo(oparg_T *oap, int dir, int dist)
|
||||
bool nv_screengo(oparg_T *oap, int dir, int dist)
|
||||
{
|
||||
int linelen = linetabsize(curwin, curwin->w_cursor.lnum);
|
||||
bool retval = true;
|
||||
@@ -5223,7 +5223,7 @@ static void nv_gv_cmd(cmdarg_T *cap)
|
||||
|
||||
/// "g0", "g^" : Like "0" and "^" but for screen lines.
|
||||
/// "gm": middle of "g0" and "g$".
|
||||
static void nv_g_home_m_cmd(cmdarg_T *cap)
|
||||
void nv_g_home_m_cmd(cmdarg_T *cap)
|
||||
{
|
||||
int i;
|
||||
const bool flag = cap->nchar == '^';
|
||||
@@ -5239,6 +5239,15 @@ static void nv_g_home_m_cmd(cmdarg_T *cap)
|
||||
if (curwin->w_virtcol >= (colnr_T)width1 && width2 > 0) {
|
||||
i = (curwin->w_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;
|
||||
}
|
||||
@@ -6402,7 +6411,7 @@ static void nv_at(cmdarg_T *cap)
|
||||
static void nv_halfpage(cmdarg_T *cap)
|
||||
{
|
||||
if (!checkclearop(cap->oap)) {
|
||||
pagescroll(cap->cmdchar == Ctrl_D, cap->count0, true);
|
||||
pagescroll(cap->cmdchar == Ctrl_D ? FORWARD : BACKWARD, cap->count0, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user