aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.c
diff options
context:
space:
mode:
authorJaehwang Jerry Jung <tomtomjhj@gmail.com>2021-09-19 01:38:58 +0900
committerGitHub <noreply@github.com>2021-09-18 12:38:58 -0400
commitde406f651c6f926db4223b69ef312777e8afe01b (patch)
treec9f601e7a987e9c94493c7157b8dd6a43d421093 /src/nvim/diff.c
parent51a98aa0c2fe3231a0ffc8a78189bc6fafd6abf6 (diff)
downloadrneovim-de406f651c6f926db4223b69ef312777e8afe01b.tar.gz
rneovim-de406f651c6f926db4223b69ef312777e8afe01b.tar.bz2
rneovim-de406f651c6f926db4223b69ef312777e8afe01b.zip
vim-patch:8.2.3394: filler lines are wrong when changing text in diff mode (#15547)
Problem: Filler lines are wrong when changing text in diff mode. Solution: Don't change the filler lines on every change. Check scrollbinding when updating the filler lines. (closes vim/vim#8809) https://github.com/vim/vim/commit/04626c243c47af91c2580eaf23e12286180e0e81
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r--src/nvim/diff.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 26269a44d2..fd5b2c6599 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -639,12 +639,18 @@ static int diff_check_sanity(tabpage_T *tp, diff_T *dp)
/// @param dofold Also recompute the folds
void diff_redraw(bool dofold)
{
+ win_T *wp_other = NULL;
+ bool used_max_fill = false;
+
need_diff_redraw = false;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (!wp->w_p_diff) {
continue;
}
redraw_later(wp, SOME_VALID);
+ if (wp != curwin) {
+ wp_other = wp;
+ }
if (dofold && foldmethodIsDiff(wp)) {
foldUpdateAll(wp);
}
@@ -658,10 +664,18 @@ void diff_redraw(bool dofold)
wp->w_topfill = (n < 0 ? 0 : n);
} else if ((n > 0) && (n > wp->w_topfill)) {
wp->w_topfill = n;
+ if (wp == curwin) {
+ used_max_fill = 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);
+ }
}
static void clear_diffin(diffin_T *din)