Skip to content

Commit 57dd4c6

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 324ff06 + f7acf2b commit 57dd4c6

4 files changed

Lines changed: 59 additions & 13 deletions

File tree

src/diff.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3206,21 +3206,23 @@ parse_diff_unified(
32063206
xdiff_out(void *priv, mmbuffer_t *mb, int nbuf)
32073207
{
32083208
diffout_T *dout = (diffout_T *)priv;
3209-
int i;
32103209
char_u *p;
32113210

3212-
for (i = 0; i < nbuf; i++)
3213-
{
3214-
// We are only interested in the header lines, skip text lines.
3215-
if (STRNCMP(mb[i].ptr, "@@ ", 3) != 0)
3216-
continue;
3217-
if (ga_grow(&dout->dout_ga, 1) == FAIL)
3218-
return -1;
3219-
p = vim_strnsave((char_u *)mb[i].ptr, mb[i].size);
3220-
if (p == NULL)
3221-
return -1;
3222-
((char_u **)dout->dout_ga.ga_data)[dout->dout_ga.ga_len++] = p;
3223-
}
3211+
// The header line always comes by itself, text lines in at least two
3212+
// parts. We drop the text part.
3213+
if (nbuf > 1)
3214+
return 0;
3215+
3216+
// sanity check
3217+
if (STRNCMP(mb[0].ptr, "@@ ", 3) != 0)
3218+
return 0;
3219+
3220+
if (ga_grow(&dout->dout_ga, 1) == FAIL)
3221+
return -1;
3222+
p = vim_strnsave((char_u *)mb[0].ptr, mb[0].size);
3223+
if (p == NULL)
3224+
return -1;
3225+
((char_u **)dout->dout_ga.ga_data)[dout->dout_ga.ga_len++] = p;
32243226
return 0;
32253227
}
32263228

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
| +0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0@1| @32||+1&&| +0#0000e05#a8a8a8255@1>a+0#0000000#ffffff0@1| @32
2+
| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0@1| @32||+1&&| +0#0000e05#a8a8a8255@1|b+0#0000000#ffffff0@1| @32
3+
| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0@1| @32||+1&&| +0#0000e05#a8a8a8255@1|c+0#0000000#ffffff0@1| @32
4+
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|@+0#0000000#5fd7ff255@1| |-|3|,|2| |+|5|,|7| |@@1| @19
5+
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|d+0#0000000#5fd7ff255@1| @32
6+
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|e+0#0000000#5fd7ff255@1| @32
7+
| +0#0000e05#a8a8a8255@1|-+0#4040ff13#afffff255@34||+1#0000000#ffffff0| +0#0000e05#a8a8a8255@1|f+0#0000000#5fd7ff255@1| @32
8+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
9+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
10+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
11+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
12+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
13+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
14+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
15+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
16+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
17+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
18+
| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33||+1#0000000&| +0#0000e05#a8a8a8255@1|~+0#4040ff13#ffffff0| @33
19+
|[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1| |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|A|l@1
20+
| +0&&@74

src/testdir/test_diffmode.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,3 +885,23 @@ func Test_diff_with_cursorline()
885885
call StopVimInTerminal(buf)
886886
call delete('Xtest_diff_cursorline')
887887
endfunc
888+
889+
func Test_diff_of_diff()
890+
if !CanRunVimInTerminal()
891+
return
892+
endif
893+
894+
call writefile([
895+
\ 'call setline(1, ["aa","bb","cc","@@ -3,2 +5,7 @@","dd","ee","ff"])',
896+
\ 'vnew',
897+
\ 'call setline(1, ["aa","bb","cc"])',
898+
\ 'windo diffthis',
899+
\ ], 'Xtest_diff_diff')
900+
let buf = RunVimInTerminal('-S Xtest_diff_diff', {})
901+
902+
call VerifyScreenDump(buf, 'Test_diff_of_diff_01', {})
903+
904+
" clean up
905+
call StopVimInTerminal(buf)
906+
call delete('Xtest_diff_diff')
907+
endfunc

src/version.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,10 @@ static char *(features[]) =
807807

808808
static int included_patches[] =
809809
{ /* Add new patch number below this line */
810+
/**/
811+
503,
812+
/**/
813+
502,
810814
/**/
811815
501,
812816
/**/

0 commit comments

Comments
 (0)