mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.0562: parsing of 'diffopt' is slightly wrong
Problem: Parsing of 'diffopt' is slightly wrong. Solution: Fix the parsing and add a test. (Jason Franklin, Christian Brabandt)
This commit is contained in:
parent
9719568533
commit
b6fc72851c
@ -2173,6 +2173,7 @@ diffopt_changed(void)
|
|||||||
int diff_flags_new = 0;
|
int diff_flags_new = 0;
|
||||||
int diff_foldcolumn_new = 2;
|
int diff_foldcolumn_new = 2;
|
||||||
long diff_algorithm_new = 0;
|
long diff_algorithm_new = 0;
|
||||||
|
long diff_indent_heuristic = 0;
|
||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
|
|
||||||
p = p_dip;
|
p = p_dip;
|
||||||
@ -2236,7 +2237,7 @@ diffopt_changed(void)
|
|||||||
else if (STRNCMP(p, "indent-heuristic", 16) == 0)
|
else if (STRNCMP(p, "indent-heuristic", 16) == 0)
|
||||||
{
|
{
|
||||||
p += 16;
|
p += 16;
|
||||||
diff_algorithm_new |= XDF_INDENT_HEURISTIC;
|
diff_indent_heuristic = XDF_INDENT_HEURISTIC;
|
||||||
}
|
}
|
||||||
else if (STRNCMP(p, "internal", 8) == 0)
|
else if (STRNCMP(p, "internal", 8) == 0)
|
||||||
{
|
{
|
||||||
@ -2276,6 +2277,8 @@ diffopt_changed(void)
|
|||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diff_algorithm_new |= diff_indent_heuristic;
|
||||||
|
|
||||||
/* Can't have both "horizontal" and "vertical". */
|
/* Can't have both "horizontal" and "vertical". */
|
||||||
if ((diff_flags_new & DIFF_HORIZONTAL) && (diff_flags_new & DIFF_VERTICAL))
|
if ((diff_flags_new & DIFF_HORIZONTAL) && (diff_flags_new & DIFF_VERTICAL))
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
@ -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#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
|
| +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
|
|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
|
||||||
|
@ -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
|
||||||
| +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
|
|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
|
||||||
|
@ -103,6 +103,8 @@ func VerifyScreenDump(buf, filename, options, ...)
|
|||||||
|
|
||||||
let i = 0
|
let i = 0
|
||||||
while 1
|
while 1
|
||||||
|
" leave some time for updating the original window
|
||||||
|
sleep 10m
|
||||||
call delete(testfile)
|
call delete(testfile)
|
||||||
call term_dumpwrite(a:buf, testfile, a:options)
|
call term_dumpwrite(a:buf, testfile, a:options)
|
||||||
if readfile(reference) == readfile(testfile)
|
if readfile(reference) == readfile(testfile)
|
||||||
@ -118,7 +120,6 @@ func VerifyScreenDump(buf, filename, options, ...)
|
|||||||
call assert_report(msg)
|
call assert_report(msg)
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
sleep 10m
|
|
||||||
let i += 1
|
let i += 1
|
||||||
endwhile
|
endwhile
|
||||||
return 0
|
return 0
|
||||||
|
@ -813,8 +813,16 @@ func Test_diff_screen()
|
|||||||
call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
|
call term_sendkeys(buf, ":set diffopt+=internal\<cr>")
|
||||||
call VerifyScreenDump(buf, 'Test_diff_10', {})
|
call VerifyScreenDump(buf, 'Test_diff_10', {})
|
||||||
|
|
||||||
call term_sendkeys(buf, ":set diffopt+=indent-heuristic\<cr>")
|
" Leave trailing : at commandline!
|
||||||
call VerifyScreenDump(buf, 'Test_diff_11', {})
|
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
|
" 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])
|
call WriteDiffFiles(buf, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
|
||||||
|
@ -792,6 +792,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
562,
|
||||||
/**/
|
/**/
|
||||||
561,
|
561,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user