From 611b43369e73b0da799226f70a6821c0c31ca222 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 25 Jul 2022 19:12:06 +0800 Subject: vim-patch:8.2.5155: in diff mode windows may get out of sync Problem: In diff mode windows may get out of sync. (Gary Johnson) Solution: Avoid that the other window scrolls for 'cursorbind'. https://github.com/vim/vim/commit/a315ce1f326b836167ca8b1037dafd93eb8d4d4e --- src/nvim/testdir/test_diffmode.vim | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'src/nvim/testdir/test_diffmode.vim') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 007b7e0f14..e059ecb493 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -1378,4 +1378,73 @@ func Test_diff_foldinvert() set scrollbind& endfunc +" This was scrolling for 'cursorbind' but 'scrollbind' is more important +func Test_diff_scroll() + CheckScreendump + + let left =<< trim END + line 1 + line 2 + line 3 + line 4 + + // Common block + // one + // containing + // four lines + + // Common block + // two + // containing + // four lines + END + call writefile(left, 'Xleft') + let right =<< trim END + line 1 + line 2 + line 3 + line 4 + + Lorem + ipsum + dolor + sit + amet, + consectetur + adipiscing + elit. + Etiam + luctus + lectus + sodales, + dictum + + // Common block + // one + // containing + // four lines + + Vestibulum + tincidunt + aliquet + nulla. + + // Common block + // two + // containing + // four lines + END + call writefile(right, 'Xright') + let buf = RunVimInTerminal('-d Xleft Xright', {'rows': 12}) + call term_sendkeys(buf, "\\jjjj") + call VerifyScreenDump(buf, 'Test_diff_scroll_1', {}) + call term_sendkeys(buf, "j") + call VerifyScreenDump(buf, 'Test_diff_scroll_2', {}) + + call StopVimInTerminal(buf) + call delete('Xleft') + call delete('Xright') +endfunc + + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 8543de3a862d55a762c130aa6a9d0e2a6c0b4838 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 25 Jul 2022 20:06:24 +0800 Subject: vim-patch:8.2.5163: crash when deleting buffers in diff mode Problem: Crash when deleting buffers in diff mode. Solution: Recompute diffs later. Skip window without a valid buffer. https://github.com/vim/vim/commit/cd38bb4d83c942c4bad596835c6766cbf32e5195 --- src/nvim/testdir/test_diffmode.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nvim/testdir/test_diffmode.vim') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index e059ecb493..7ab8d0347b 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -1446,5 +1446,17 @@ func Test_diff_scroll() call delete('Xright') endfunc +" This was trying to update diffs for a buffer being closed +func Test_diff_only() + silent! lfile + set diff + lopen + norm o + silent! norm o + + set nodiff + %bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From 771564b00e5b64ac74be443dde84e160bc7fce05 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 25 Jul 2022 20:09:23 +0800 Subject: vim-patch:8.2.5164: invalid memory access after diff buffer manipulations Problem: Invalid memory access after diff buffer manipulations. Solution: Use zero offset when change removes all lines in a diff block. https://github.com/vim/vim/commit/c101abff4c6756db4f5e740fde289decb9452efa --- src/nvim/testdir/test_diffmode.vim | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/nvim/testdir/test_diffmode.vim') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 7ab8d0347b..3eabad28d0 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -1458,5 +1458,17 @@ func Test_diff_only() %bwipe! endfunc +" This was causing invalid diff block values +" FIXME: somehow this causes a valgrind error when run directly but not when +" run as a test. +func Test_diff_manipulations() + set diff + split 0 + sil! norm R doobdeuR doobdeuR doobdeu + + set nodiff + %bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From e4079f3b5a62a0a3888d4e824e8c39a7d171c5b4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 25 Jul 2022 20:11:13 +0800 Subject: vim-patch:8.2.5166: test for DiffUpdated fails Problem: Test for DiffUpdated fails. Solution: Also accept a count of two. https://github.com/vim/vim/commit/f65cc665fa751bad3ffe75f58ce1251d6695949f --- src/nvim/testdir/test_diffmode.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/testdir/test_diffmode.vim') diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim index 3eabad28d0..bc931b1e1b 100644 --- a/src/nvim/testdir/test_diffmode.vim +++ b/src/nvim/testdir/test_diffmode.vim @@ -33,7 +33,8 @@ func Test_diff_fold_sync() call win_gotoid(winone) call assert_equal(23, getcurpos()[1]) - call assert_equal(1, g:update_count) + " depending on how redraw is done DiffUpdated may be triggered once or twice + call assert_inrange(1, 2, g:update_count) au! DiffUpdated windo diffoff -- cgit