diff src/window.c @ 31384:992bfd3aee3f v9.0.1025

patch 9.0.1025: WinScrolled is not triggered when filler lines change Commit: https://github.com/vim/vim/commit/3fc84dc2c7efecd7c14ce341cd777475058936fd Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Dec 7 09:17:59 2022 +0000 patch 9.0.1025: WinScrolled is not triggered when filler lines change Problem: WinScrolled is not triggered when filler lines change. Solution: Add "topfill" to the values that WinScrolled triggers on. (closes #11668)
author Bram Moolenaar <Bram@vim.org>
date Wed, 07 Dec 2022 10:30:04 +0100
parents 4bc9cd62d378
children ede2bd5f3426
line wrap: on
line diff
--- a/src/window.c
+++ b/src/window.c
@@ -2855,6 +2855,9 @@ snapshot_windows_scroll_size(void)
     FOR_ALL_WINDOWS(wp)
     {
 	wp->w_last_topline = wp->w_topline;
+#ifdef FEAT_DIFF
+	wp->w_last_topfill = wp->w_topfill;
+#endif
 	wp->w_last_leftcol = wp->w_leftcol;
 	wp->w_last_skipcol = wp->w_skipcol;
 	wp->w_last_width = wp->w_width;
@@ -2886,6 +2889,9 @@ make_win_info_dict(
 	int width,
 	int height,
 	int topline,
+# ifdef FEAT_DIFF
+	int topfill,
+# endif
 	int leftcol,
 	int skipcol)
 {
@@ -2910,6 +2916,13 @@ make_win_info_dict(
 	tv.vval.v_number = topline;
 	if (dict_add_tv(d, "topline", &tv) == FAIL)
 	    break;
+#ifdef FEAT_DIFF
+	tv.vval.v_number = topfill;
+#else
+	tv.vval.v_number = 0;
+#endif
+	if (dict_add_tv(d, "topfill", &tv) == FAIL)
+	    break;
 	tv.vval.v_number = leftcol;
 	if (dict_add_tv(d, "leftcol", &tv) == FAIL)
 	    break;
@@ -2958,6 +2971,9 @@ check_window_scroll_resize(
     int tot_width = 0;
     int tot_height = 0;
     int tot_topline = 0;
+# ifdef FEAT_DIFF
+    int tot_topfill = 0;
+# endif
     int tot_leftcol = 0;
     int tot_skipcol = 0;
 #endif
@@ -2995,6 +3011,9 @@ check_window_scroll_resize(
 	}
 
 	int scroll_changed = wp->w_last_topline != wp->w_topline
+#ifdef FEAT_DIFF
+				|| wp->w_last_topfill != wp->w_topfill
+#endif
 				|| wp->w_last_leftcol != wp->w_leftcol
 				|| wp->w_last_skipcol != wp->w_skipcol;
 	if (scroll_changed)
@@ -3011,10 +3030,16 @@ check_window_scroll_resize(
 	    int width = wp->w_width - wp->w_last_width;
 	    int height = wp->w_height - wp->w_last_height;
 	    int topline = wp->w_topline - wp->w_last_topline;
+#ifdef FEAT_DIFF
+	    int topfill = wp->w_topfill - wp->w_last_topfill;
+#endif
 	    int leftcol = wp->w_leftcol - wp->w_last_leftcol;
 	    int skipcol = wp->w_skipcol - wp->w_last_skipcol;
-	    dict_T *d = make_win_info_dict(width, height,
-						    topline, leftcol, skipcol);
+	    dict_T *d = make_win_info_dict(width, height, topline,
+#ifdef FEAT_DIFF
+							    topfill,
+#endif
+							    leftcol, skipcol);
 	    if (d == NULL)
 		break;
 	    char winid[NUMBUFLEN];
@@ -3029,6 +3054,9 @@ check_window_scroll_resize(
 	    tot_width += abs(width);
 	    tot_height += abs(height);
 	    tot_topline += abs(topline);
+#ifdef FEAT_DIFF
+	    tot_topfill += abs(topfill);
+#endif
 	    tot_leftcol += abs(leftcol);
 	    tot_skipcol += abs(skipcol);
 	}
@@ -3038,8 +3066,11 @@ check_window_scroll_resize(
 #ifdef FEAT_EVAL
     if (v_event != NULL)
     {
-	dict_T *alldict = make_win_info_dict(tot_width, tot_height,
-					tot_topline, tot_leftcol, tot_skipcol);
+	dict_T *alldict = make_win_info_dict(tot_width, tot_height, tot_topline,
+# ifdef FEAT_DIFF
+						    tot_topfill,
+# endif
+						    tot_leftcol, tot_skipcol);
 	if (alldict != NULL)
 	{
 	    if (dict_add_dict(v_event, "all", alldict) == FAIL)