comparison src/normal.c @ 34761:b20609f4ab37 v9.1.0258

patch 9.1.0258: half-page scrolling broke backward compatibility Commit: https://github.com/vim/vim/commit/cb204e688e5c9d56a78b621ef27c35d91860cb09 Author: Luuk van Baal <luukvbaal@gmail.com> Date: Tue Apr 2 20:49:45 2024 +0200 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>
author Christian Brabandt <cb@256bit.org>
date Tue, 02 Apr 2024 21:00:06 +0200
parents ca2da8e8fb53
children 8e38ceda0822
comparison
equal deleted inserted replaced
34760:d14cb0d9988c 34761:b20609f4ab37
2301 * lines rather than lines in the file. 2301 * lines rather than lines in the file.
2302 * 'dist' must be positive. 2302 * 'dist' must be positive.
2303 * 2303 *
2304 * Return OK if able to move cursor, FAIL otherwise. 2304 * Return OK if able to move cursor, FAIL otherwise.
2305 */ 2305 */
2306 static int 2306 int
2307 nv_screengo(oparg_T *oap, int dir, long dist) 2307 nv_screengo(oparg_T *oap, int dir, long dist)
2308 { 2308 {
2309 2309
2310 int linelen = linetabsize_no_outer(curwin, curwin->w_cursor.lnum); 2310 int linelen = linetabsize_no_outer(curwin, curwin->w_cursor.lnum);
2311 2311
5743 5743
5744 /* 5744 /*
5745 * "g0", "g^" : Like "0" and "^" but for screen lines. 5745 * "g0", "g^" : Like "0" and "^" but for screen lines.
5746 * "gm": middle of "g0" and "g$". 5746 * "gm": middle of "g0" and "g$".
5747 */ 5747 */
5748 static void 5748 void
5749 nv_g_home_m_cmd(cmdarg_T *cap) 5749 nv_g_home_m_cmd(cmdarg_T *cap)
5750 { 5750 {
5751 int i; 5751 int i;
5752 int flag = FALSE; 5752 int flag = FALSE;
5753 5753
5769 #endif 5769 #endif
5770 ; 5770 ;
5771 i = 0; 5771 i = 0;
5772 if (virtcol >= (colnr_T)width1 && width2 > 0) 5772 if (virtcol >= (colnr_T)width1 && width2 > 0)
5773 i = (virtcol - width1) / width2 * width2 + width1; 5773 i = (virtcol - width1) / width2 * width2 + width1;
5774
5775 // When ending up below 'smoothscroll' marker, move just beyond it so
5776 // that skipcol is not adjusted later.
5777 if (curwin->w_skipcol > 0 && curwin->w_cursor.lnum == curwin->w_topline)
5778 {
5779 int overlap = sms_marker_overlap(curwin, -1);
5780 if (overlap > 0 && i == curwin->w_skipcol)
5781 i += overlap;
5782 }
5774 } 5783 }
5775 else 5784 else
5776 i = curwin->w_leftcol; 5785 i = curwin->w_leftcol;
5777 // Go to the middle of the screen line. When 'number' or 5786 // Go to the middle of the screen line. When 'number' or
5778 // 'relativenumber' is on and lines are wrapping the middle can be more 5787 // 'relativenumber' is on and lines are wrapping the middle can be more
7261 * Handle the CTRL-U and CTRL-D commands. 7270 * Handle the CTRL-U and CTRL-D commands.
7262 */ 7271 */
7263 static void 7272 static void
7264 nv_halfpage(cmdarg_T *cap) 7273 nv_halfpage(cmdarg_T *cap)
7265 { 7274 {
7275 int dir = cap->cmdchar == Ctrl_D ? FORWARD : BACKWARD;
7266 if (!checkclearop(cap->oap)) 7276 if (!checkclearop(cap->oap))
7267 pagescroll(cap->cmdchar == Ctrl_D, cap->count0, TRUE); 7277 pagescroll(dir, cap->count0, TRUE);
7268 } 7278 }
7269 7279
7270 /* 7280 /*
7271 * Handle "J" or "gJ" command. 7281 * Handle "J" or "gJ" command.
7272 */ 7282 */