summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-09-16 14:10:31 +0200
committerBram Moolenaar <Bram@vim.org>2018-09-16 14:10:31 +0200
commite3521d9cbb786806eaff106707851d37d2c0ecef (patch)
tree37457955339b93a9bd1410491b2a1f1e9bea2b72 /src/diff.c
parent785fc6567f572b8caefbc89ec29bbd8b801464ae (diff)
downloadvim-git-e3521d9cbb786806eaff106707851d37d2c0ecef.tar.gz
patch 8.1.0394: diffs are not always updated correctlyv8.1.0394
Problem: Diffs are not always updated correctly. Solution: When using internal diff update for any changes properly.
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/diff.c b/src/diff.c
index 149022a11..69ba7a389 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -292,6 +292,16 @@ diff_mark_adjust_tp(
linenr_T lnum_deleted = line1; /* lnum of remaining deletion */
int check_unchanged;
+ if (diff_internal())
+ {
+ // Will udpate diffs before redrawing. Set _invalid to update the
+ // diffs themselves, set _update to also update folds properly just
+ // before redrawing.
+ tp->tp_diff_invalid = TRUE;
+ tp->tp_diff_update = TRUE;
+ return;
+ }
+
if (line2 == MAXLNUM)
{
/* mark_adjust(99, MAXLNUM, 9, 0): insert lines */
@@ -640,7 +650,7 @@ diff_check_sanity(tabpage_T *tp, diff_T *dp)
*/
static void
diff_redraw(
- int dofold) /* also recompute the folds */
+ int dofold) // also recompute the folds
{
win_T *wp;
int n;
@@ -863,7 +873,7 @@ theend:
* Note that if the internal diff failed for one of the buffers, the external
* diff will be used anyway.
*/
- static int
+ int
diff_internal(void)
{
return (diff_flags & DIFF_INTERNAL) != 0 && *p_dex == NUL;
@@ -887,9 +897,9 @@ diff_internal_failed(void)
/*
* Completely update the diffs for the buffers involved.
- * This uses the ordinary "diff" command.
- * The buffers are written to a file, also for unmodified buffers (the file
- * could have been produced by autocommands, e.g. the netrw plugin).
+ * When using the external "diff" command the buffers are written to a file,
+ * also for unmodified buffers (the file could have been produced by
+ * autocommands, e.g. the netrw plugin).
*/
void
ex_diffupdate(exarg_T *eap) // "eap" can be NULL