On Di, 04 Dez 2018, Christian Brabandt wrote:
>
> On Di, 04 Dez 2018, Jason Franklin wrote:
>
> > > Does the test fail if the change to diff.c is not applied?
> >
> > Good catch. It looks like the test doesn't fail for me when
> > the change to "diff.c" is not applied.
>
> Yeah, I see. In fact, it should actually fail in both cases, because the
> commandline differs from the recorded screen dump. Let me have a look,
> if I can make it work.
There were actually quite a few more minor bugs in the test suite, that
prevented correctly testing and it was tedious to find the root cause.
One problem was, that the VerifyScreenDump() function did a term_dump()
too early, before the nested Vim had a chance to redraw, so that it
returned both dumps being equal, while they were in fact different.
It almost drove me crazy until I finally found that cause.
Once I fixed that, the dump/Test_diff_09.dump started to fail. And this
was in fact expected, as the dump was made with algorithm:patience on
the commandline, while the test used algorithm:histogram.
So that dump had to be fixed.
Also the Test_diff_11.dump was changed, so that the commandline remained
empty as well.
Once all that was fixed, the test started to behave as expected. Uff.
So attached is the complete patch.
Best,
Christian
--
Es gab Zeiten, da man die Sklaven legal kaufen mußte.
-- Stanislaw Jerzy Lec (eig. S. J. de Tusch-Letz)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/diff.c b/src/diff.c
index 0399e7967..7f7e15df6 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -2173,6 +2173,7 @@ diffopt_changed(void)
int diff_flags_new = 0;
int diff_foldcolumn_new = 2;
long diff_algorithm_new = 0;
+ long diff_indent_heuristic = 0;
tabpage_T *tp;
p = p_dip;
@@ -2236,7 +2237,7 @@ diffopt_changed(void)
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)
{
@@ -2276,6 +2277,8 @@ diffopt_changed(void)
++p;
}
+ 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/src/testdir/dumps/Test_diff_09.dump b/src/testdir/dumps/Test_diff_09.dump
index 6445a5776..95692b62a 100644
--- a/src/testdir/dumps/Test_diff_09.dump
+++ b/src/testdir/dumps/Test_diff_09.dump
@@ -17,4 +17,4 @@
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|{| @29||+1&&| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|{| @29
| +0#0000e05#a8a8a8255@1| +0#0000000#5fd7ff255@7|p|r|i|n|t|f|(|"|Y|o|u|r| |a|n|s|w|e|r| |i|s|:| |"|)|;||+1&#ffffff0| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34
|X+3#0000000#ffffff0|f|i|l|e|1| @12|1|,|1| @11|T|o|p| |X+1&&|f|i|l|e|2| @12|1|,|1| @11|T|o|p
-|:+0&&|s|e|t| |d|i|f@1|o|p|t|+|=|a|l|g|o|r|i|t|h|m|:|p|a|t|i|e|n|c|e| @42
+|:+0&&|s|e|t| |d|i|f@1|o|p|t|+|=|a|l|g|o|r|i|t|h|m|:|h|i|s|t|o|g|r|a|m| @41
diff --git a/src/testdir/dumps/Test_diff_11.dump b/src/testdir/dumps/Test_diff_11.dump
index 0e4268ec7..3b24ebbeb 100644
--- a/src/testdir/dumps/Test_diff_11.dump
+++ b/src/testdir/dumps/Test_diff_11.dump
@@ -17,4 +17,4 @@
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
|X+3#0000000&|f|i|l|e|1| @12|1|,|0|-|1| @9|A|l@1| |X+1&&|f|i|l|e|2| @12|1|,|0|-|1| @9|A|l@1
-|:+0&&|s|e|t| |d|i|f@1|o|p|t|+|=|i|n|d|e|n|t|-|h|e|u|r|i|s|t|i|c| @44
+|:+0&&| @73
diff --git a/src/testdir/screendump.vim b/src/testdir/screendump.vim
index 1b74c1b33..139f708c0 100644
--- a/src/testdir/screendump.vim
+++ b/src/testdir/screendump.vim
@@ -103,6 +103,8 @@ func VerifyScreenDump(buf, filename, options, ...)
let i = 0
while 1
+ " leave some time for updating the original window
+ sleep 10m
call delete(testfile)
call term_dumpwrite(a:buf, testfile, a:options)
if readfile(reference) == readfile(testfile)
@@ -113,12 +115,11 @@ func VerifyScreenDump(buf, filename, options, ...)
" Leave the test file around for inspection.
let msg = 'See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")'
if a:0 == 1
- let msg = a:1 . ': ' . msg
+ let msg = a:1 . ': ' . msg
endif
call assert_report(msg)
return 1
endif
- sleep 10m
let i += 1
endwhile
return 0
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index 4f20395ab..84fb4519c 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -813,8 +813,16 @@ func Test_diff_screen()
call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
call VerifyScreenDump(buf, 'Test_diff_10', {})
- call term_sendkeys(buf, ":set diffopt+=indent-heuristic\<cr>")
- call VerifyScreenDump(buf, 'Test_diff_11', {})
+ " Leave trailing : at commandline!
+ call term_sendkeys(buf, ":set diffopt+=indent-heuristic\<cr>:\<cr>")
+ call VerifyScreenDump(buf, 'Test_diff_11', {}, 'one')
+ " shouldn't matter, if indent-algorithm comes before or after the algorithm
+ call term_sendkeys(buf, ":set diffopt&\<cr>")
+ call term_sendkeys(buf, ":set diffopt+=indent-heuristic,algorithm:patience\<cr>:\<cr>")
+ call VerifyScreenDump(buf, 'Test_diff_11', {}, 'two')
+ call term_sendkeys(buf, ":set diffopt&\<cr>")
+ call term_sendkeys(buf, ":set diffopt+=algorithm:patience,indent-heuristic\<cr>:\<cr>")
+ call VerifyScreenDump(buf, 'Test_diff_11', {}, 'three')
" Test 12: diff the same file
call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])