diff src/move.c @ 31329:5c83140aafc9 v9.0.0998

patch 9.0.0998: "gk" may reset skipcol when not needed Commit: https://github.com/vim/vim/commit/1b73edd9ee40aec400f3611f59823cec5fd1c489 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 3 11:51:54 2022 +0000 patch 9.0.0998: "gk" may reset skipcol when not needed Problem: "gk" may reset skipcol when not needed. Solution: Only reset skipcol if the cursor column is less.
author Bram Moolenaar <Bram@vim.org>
date Sat, 03 Dec 2022 13:00:04 +0100
parents 243c35fad9cb
children bfbcc148da58
line wrap: on
line diff
--- a/src/move.c
+++ b/src/move.c
@@ -2343,7 +2343,7 @@ scroll_cursor_top(int min_scroll, int al
     {
 	/*
 	 * If "always" is FALSE, only adjust topline to a lower value, higher
-	 * value may happen with wrapping lines
+	 * value may happen with wrapping lines.
 	 */
 	if (new_topline < curwin->w_topline || always)
 	    curwin->w_topline = new_topline;
@@ -2360,7 +2360,8 @@ scroll_cursor_top(int min_scroll, int al
 	check_topfill(curwin, FALSE);
 #endif
 	// TODO: if the line doesn't fit may optimize w_skipcol
-	if (curwin->w_topline == curwin->w_cursor.lnum)
+	if (curwin->w_topline == curwin->w_cursor.lnum
+		&& curwin->w_skipcol >= curwin->w_cursor.col)
 	    reset_skipcol();
 	if (curwin->w_topline != old_topline
 		|| curwin->w_skipcol != old_skipcol