From cf1ffa91667a482c6355f5999b9e97ccc0b4126a Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 2 Dec 2018 22:58:07 +0200 Subject: vim-patch:8.1.0360: using an external diff program is slow and inflexible Problem: Using an external diff program is slow and inflexible. Solution: Include the xdiff library. (Christian Brabandt) Use it by default. https://github.com/vim/vim/commit/e828b7621cf9065a3582be0c4dd1e0e846e335bf vim-patch:8.1.0360 vim-patch:8.1.0364 vim-patch:8.1.0366 vim-patch:8.1.0370 vim-patch:8.1.0377 vim-patch:8.1.0378 vim-patch:8.1.0381 vim-patch:8.1.0396 vim-patch:8.1.0432 --- src/nvim/testdir/test_diffmode.vim | 105 +++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 16 deletions(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index afe289b262..3e47b02fc8 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -33,6 +33,18 @@ func Test_diff_fold_sync() endfunc func Test_vert_split() + set diffopt=filler + call Common_vert_split() + set diffopt& +endfunc + +func Test_vert_split_internal() + set diffopt=internal,filler + call Common_vert_split() + set diffopt& +endfunc + +func Common_vert_split() " Disable the title to avoid xterm keeping the wrong one. set notitle noicon new @@ -275,10 +287,8 @@ func Test_diffoff() bwipe! endfunc -func Test_diffopt_icase() - set diffopt=icase,foldcolumn:0 - - e one +func Common_icase_test() + edit one call setline(1, ['One', 'Two', 'Three', 'Four', 'Fi#ve']) redraw let normattr = screenattr(1, 1) @@ -300,32 +310,54 @@ func Test_diffopt_icase() diffoff! %bwipe! +endfunc + +func Test_diffopt_icase() + set diffopt=icase,foldcolumn:0 + call Common_icase_test() set diffopt& endfunc -func Test_diffopt_iwhite() - set diffopt=iwhite,foldcolumn:0 +func Test_diffopt_icase_internal() + set diffopt=icase,foldcolumn:0,internal + call Common_icase_test() + set diffopt& +endfunc - e one - " Difference in trailing spaces should be ignored, +func Common_iwhite_test() + edit one + " Difference in trailing spaces and amount of spaces should be ignored, " but not other space differences. - call setline(1, ["One \t", 'Two', 'Three', 'Four']) + call setline(1, ["One \t", 'Two', 'Three', 'one two', 'one two', 'Four']) redraw let normattr = screenattr(1, 1) diffthis botright vert new two - call setline(1, ["One\t ", "Two\t ", 'Three', ' Four']) + call setline(1, ["One\t ", "Two\t ", 'Three', 'one two', 'onetwo', ' Four']) diffthis redraw call assert_equal(normattr, screenattr(1, 1)) call assert_equal(normattr, screenattr(2, 1)) call assert_equal(normattr, screenattr(3, 1)) - call assert_notequal(normattr, screenattr(4, 1)) + call assert_equal(normattr, screenattr(4, 1)) + call assert_notequal(normattr, screenattr(5, 1)) + call assert_notequal(normattr, screenattr(6, 1)) diffoff! %bwipe! +endfunc + +func Test_diffopt_iwhite() + set diffopt=iwhite,foldcolumn:0 + call Common_iwhite_test() + set diffopt& +endfunc + +func Test_diffopt_iwhite_internal() + set diffopt=internal,iwhite,foldcolumn:0 + call Common_iwhite_test() set diffopt& endfunc @@ -339,8 +371,13 @@ func Test_diffopt_context() set diffopt=context:2 call assert_equal('+-- 2 lines: 1', foldtextresult(1)) + set diffopt=internal,context:2 + call assert_equal('+-- 2 lines: 1', foldtextresult(1)) + set diffopt=context:1 call assert_equal('+-- 3 lines: 1', foldtextresult(1)) + set diffopt=internal,context:1 + call assert_equal('+-- 3 lines: 1', foldtextresult(1)) diffoff! %bwipe! @@ -348,7 +385,7 @@ func Test_diffopt_context() endfunc func Test_diffopt_horizontal() - set diffopt=horizontal + set diffopt=internal,horizontal diffsplit call assert_equal(&columns, winwidth(1)) @@ -362,7 +399,7 @@ func Test_diffopt_horizontal() endfunc func Test_diffopt_vertical() - set diffopt=vertical + set diffopt=internal,vertical diffsplit call assert_equal(&lines - 2, winheight(1)) @@ -376,7 +413,7 @@ func Test_diffopt_vertical() endfunc func Test_diffopt_hiddenoff() - set diffopt=filler,foldcolumn:0,hiddenoff + set diffopt=internal,filler,foldcolumn:0,hiddenoff e! one call setline(1, ['Two', 'Three']) redraw @@ -399,7 +436,7 @@ func Test_diffopt_hiddenoff() endfunc func Test_diffoff_hidden() - set diffopt=filler,foldcolumn:0 + set diffopt=internal,filler,foldcolumn:0 e! one call setline(1, ['Two', 'Three']) redraw @@ -523,7 +560,7 @@ func Test_diffpatch() 3 + 4 . - saveas Xpatch + saveas! Xpatch bwipe! new call assert_fails('diffpatch Xpatch', 'E816:') @@ -569,6 +606,22 @@ func Test_diff_nomodifiable() %bwipe! endfunc +func Test_diff_filler() + new + call setline(1, [1, 2, 3, 'x', 4]) + diffthis + vnew + call setline(1, [1, 2, 'y', 'y', 3, 4]) + diffthis + redraw + + call assert_equal([0, 0, 0, 0, 0, 0, 0, 1, 0], map(range(-1, 7), 'diff_filler(v:val)')) + wincmd w + call assert_equal([0, 0, 0, 0, 2, 0, 0, 0], map(range(-1, 6), 'diff_filler(v:val)')) + + %bwipe! +endfunc + func Test_diff_lastline() enew! only! @@ -615,3 +668,23 @@ func Test_diff_with_cursorline() call StopVimInTerminal(buf) call delete('Xtest_diff_cursorline') endfunc + +func Test_diff_of_diff() + if !CanRunVimInTerminal() + return + endif + + call writefile([ + \ 'call setline(1, ["aa","bb","cc","@@ -3,2 +5,7 @@","dd","ee","ff"])', + \ 'vnew', + \ 'call setline(1, ["aa","bb","cc"])', + \ 'windo diffthis', + \ ], 'Xtest_diff_diff') + let buf = RunVimInTerminal('-S Xtest_diff_diff', {}) + + call VerifyScreenDump(buf, 'Test_diff_of_diff_01', {}) + + " clean up + call StopVimInTerminal(buf) + call delete('Xtest_diff_diff') +endfunc -- cgit From 72c5a9db70f263eaac12aee140da03190e2fa605 Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 9 Dec 2018 13:50:14 +0200 Subject: vim-patch:8.1.0375: cannot use diff mode with Cygwin diff.exe Problem: Cannot use diff mode with Cygwin diff.exe. (Igor Forca) Solution: Skip over unrecognized lines in the diff output. https://github.com/vim/vim/commit/3b8defd0a52fc1276816608e7bb24b628ab14c2e --- src/nvim/testdir/test_diffmode.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 3e47b02fc8..645a87848b 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -517,7 +517,9 @@ func Test_diffexpr() endif func DiffExpr() - silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>' . v:fname_out + " Prepend some text to check diff type detection + call writefile(['warning', ' message'], v:fname_out) + silent exe '!diff ' . v:fname_in . ' ' . v:fname_new . '>>' . v:fname_out endfunc set diffexpr=DiffExpr() set diffopt=foldcolumn:0 -- cgit From 2c92a4d0c8a398c8a7dfd1666fdcfd2ab89cc887 Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 9 Dec 2018 19:26:12 +0200 Subject: vim-patch:8.1.0397: no event triggered after updating diffs Problem: No event triggered after updating diffs. Solution: Add the DiffUpdated event. https://github.com/vim/vim/commit/e8fa05b5bc2d6d76bf5af50176a63655d00d1110 --- src/nvim/testdir/test_diffmode.vim | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 645a87848b..6f25179ab1 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -2,6 +2,9 @@ func Test_diff_fold_sync() enew! + let g:update_count = 0 + au DiffUpdated * let g:update_count += 1 + let l = range(50) call setline(1, l) diffthis @@ -27,6 +30,9 @@ func Test_diff_fold_sync() call win_gotoid(winone) call assert_equal(23, getcurpos()[1]) + call assert_equal(1, g:update_count) + au! DiffUpdated + windo diffoff close! set nomodified -- cgit From e104228b1c89022f0b284753ff92deb2e9374c5b Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 9 Dec 2018 19:55:08 +0200 Subject: vim-patch:8.1.0458: ml_get error and crash when using "do" Problem: Ml_get error and crash when using "do". Solution: Adjust cursor position also when diffupdate is not needed. (Hirohito Higashi) https://github.com/vim/vim/commit/df77cef92ec034796723ffa3adb12e8b46daa98e --- src/nvim/testdir/test_diffmode.vim | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 6f25179ab1..f34c2fd26d 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -275,6 +275,28 @@ func Test_dp_do_buffer() %bwipe! endfunc +func Test_do_lastline() + e! one + call setline(1, ['1','2','3','4','5','6']) + diffthis + + new two + call setline(1, ['2','4','5']) + diffthis + + 1 + norm dp]c + norm dp]c + wincmd w + call assert_equal(4, line('$')) + norm G + norm do + call assert_equal(3, line('$')) + + windo diffoff + %bwipe! +endfunc + func Test_diffoff() enew! call setline(1, ['Two', 'Three']) -- cgit From 8f20c22e10c35075afd97bf6af50fb6d9a2dc710 Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sun, 9 Dec 2018 20:05:53 +0200 Subject: vim-patch:8.1.0497: :%diffput changes order of lines Problem: :%diffput changes order of lines. (Markus Braun) Solution: Do adjust marks when using internal diff. https://github.com/vim/vim/commit/5f57bdcab77bc417ae0357fe8ad6c7259b6d25df --- src/nvim/testdir/test_diffmode.vim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index f34c2fd26d..ad3eec3274 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -219,6 +219,26 @@ func Test_diffget_diffput() %bwipe! endfunc +" Test putting two changes from one buffer to another +func Test_diffput_two() + new a + let win_a = win_getid() + call setline(1, range(1, 10)) + diffthis + new b + let win_b = win_getid() + call setline(1, range(1, 10)) + 8del + 5del + diffthis + call win_gotoid(win_a) + %diffput + call win_gotoid(win_b) + call assert_equal(map(range(1, 10), 'string(v:val)'), getline(1, '$')) + bwipe! a + bwipe! b +endfunc + func Test_dp_do_buffer() e! one let bn1=bufnr('%') -- cgit