diff options
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r-- | src/nvim/diff.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c index 80b8920a7f..efbc2fd0db 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -638,7 +638,8 @@ static int diff_check_sanity(tabpage_T *tp, diff_T *dp) void diff_redraw(bool dofold) { win_T *wp_other = NULL; - bool used_max_fill = false; + bool used_max_fill_other = false; + bool used_max_fill_curwin = false; need_diff_redraw = false; FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { @@ -663,16 +664,24 @@ void diff_redraw(bool dofold) } else if ((n > 0) && (n > wp->w_topfill)) { wp->w_topfill = n; if (wp == curwin) { - used_max_fill = true; + used_max_fill_curwin = true; + } else if (wp_other != NULL) { + used_max_fill_other = true; } } check_topfill(wp, false); } } - if (wp_other != NULL && used_max_fill && curwin->w_p_scb) { - // The current window was set to used the maximum number of filler - // lines, may need to reduce them. - diff_set_topline(wp_other, curwin); + if (wp_other != NULL && curwin->w_p_scb) { + if (used_max_fill_curwin) { + // The current window was set to used the maximum number of filler + // lines, may need to reduce them. + diff_set_topline(wp_other, curwin); + } else if (used_max_fill_other) { + // The other window was set to used the maximum number of filler + // lines, may need to reduce them. + diff_set_topline(curwin, wp_other); + } } } |