aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/diff.c
diff options
context:
space:
mode:
authorAnatolii Sakhnik <sakhnik@gmail.com>2018-12-09 15:31:22 +0200
committerAnatolii Sakhnik <sakhnik@gmail.com>2018-12-09 19:45:56 +0200
commit7b6c92eac1b7aa702f734120bdd18b5a4f6cfe04 (patch)
tree772c85f99dfe923ffb0358ecad3b62613c081393 /src/nvim/diff.c
parent972ad1119557a0f72f1907c6758d6ed56438e5b3 (diff)
downloadrneovim-7b6c92eac1b7aa702f734120bdd18b5a4f6cfe04.tar.gz
rneovim-7b6c92eac1b7aa702f734120bdd18b5a4f6cfe04.tar.bz2
rneovim-7b6c92eac1b7aa702f734120bdd18b5a4f6cfe04.zip
vim-patch:8.1.0394: diffs are not always updated correctly
Problem: Diffs are not always updated correctly. Solution: When using internal diff update for any changes properly. https://github.com/vim/vim/commit/e3521d9cbb786806eaff106707851d37d2c0ecef
Diffstat (limited to 'src/nvim/diff.c')
-rw-r--r--src/nvim/diff.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 6e034485d9..a927983374 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -266,6 +266,15 @@ void diff_mark_adjust(linenr_T line1, linenr_T line2, long amount,
static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1,
linenr_T line2, long amount, long amount_after)
{
+ 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;
+ }
+
int inserted;
int deleted;
if (line2 == MAXLNUM) {
@@ -840,7 +849,7 @@ theend:
/// Note that if the internal diff failed for one of the buffers, the external
/// diff will be used anyway.
///
-static int diff_internal(void)
+int diff_internal(void)
{
return (diff_flags & DIFF_INTERNAL) != 0 && *p_dex == NUL;
}
@@ -864,9 +873,9 @@ static int 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).
///
/// @param eap can be NULL
void ex_diffupdate(exarg_T *eap)