0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

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)
This commit is contained in:
zeertzjq
2022-12-07 09:17:59 +00:00
committed by Bram Moolenaar
parent 86b4816766
commit 3fc84dc2c7
5 changed files with 111 additions and 15 deletions

View File

@@ -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)