aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/diff.c5
-rw-r--r--test/functional/ui/diff_spec.lua24
2 files changed, 28 insertions, 1 deletions
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 19751cb73a..2e0b198c13 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -2109,6 +2109,7 @@ int diffopt_changed(void)
int diff_flags_new = 0;
int diff_foldcolumn_new = 2;
long diff_algorithm_new = 0;
+ long diff_indent_heuristic = 0;
char_u *p = p_dip;
while (*p != NUL) {
@@ -2147,7 +2148,7 @@ int diffopt_changed(void)
diff_flags_new |= DIFF_HIDDEN_OFF;
} else if (STRNCMP(p, "indent-heuristic", 16) == 0) {
p += 16;
- diff_algorithm_new |= XDF_INDENT_HEURISTIC;
+ diff_indent_heuristic = XDF_INDENT_HEURISTIC;
} else if (STRNCMP(p, "internal", 8) == 0) {
p += 8;
diff_flags_new |= DIFF_INTERNAL;
@@ -2179,6 +2180,8 @@ int diffopt_changed(void)
}
}
+ diff_algorithm_new |= diff_indent_heuristic;
+
// Can't have both "horizontal" and "vertical".
if ((diff_flags_new & DIFF_HORIZONTAL) && (diff_flags_new & DIFF_VERTICAL)) {
return FAIL;
diff --git a/test/functional/ui/diff_spec.lua b/test/functional/ui/diff_spec.lua
index 4d81d85553..8e6756e550 100644
--- a/test/functional/ui/diff_spec.lua
+++ b/test/functional/ui/diff_spec.lua
@@ -578,6 +578,30 @@ int main(int argc, char **argv)
|
]])
end)
+
+ it('indent-heuristic random order', function()
+ reread()
+ feed(':set diffopt=internal,filler,indent-heuristic,algorithm:patience<cr>')
+ feed(':<cr>')
+ screen:expect([[
+ {1: }^def finalize(value{3:│}{1: }def finalize(valu|
+ {1: } {3:│}{1: } |
+ {1: }{2:------------------}{3:│}{1: }{4: values.each do }|
+ {1: }{2:------------------}{3:│}{1: }{4: v.prepare }|
+ {1: }{2:------------------}{3:│}{1: }{4: end }|
+ {1: }{2:------------------}{3:│}{1: }{4: }|
+ {1: } values.each do |{3:│}{1: } values.each do |
+ {1: } v.finalize {3:│}{1: } v.finalize |
+ {1: } end {3:│}{1: } end |
+ {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {1: }{6:~ }{3:│}{1: }{6:~ }|
+ {7:<onal-diff-screen-1 }{3:<l-diff-screen-1.2 }|
+ : |
+ ]])
+ end)
end)
it('Diff the same file', function()