aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_diffmode.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-25 21:32:30 +0800
committerGitHub <noreply@github.com>2022-07-25 21:32:30 +0800
commit7961f79904f6583ed3279fb1c73f2107ce9603ef (patch)
treeeca714b580325f4e5742a027015e10280b80f72b /src/nvim/testdir/test_diffmode.vim
parente12035fc0ce2f94015e665e410d09f58647078ed (diff)
parente4079f3b5a62a0a3888d4e824e8c39a7d171c5b4 (diff)
downloadrneovim-7961f79904f6583ed3279fb1c73f2107ce9603ef.tar.gz
rneovim-7961f79904f6583ed3279fb1c73f2107ce9603ef.tar.bz2
rneovim-7961f79904f6583ed3279fb1c73f2107ce9603ef.zip
Merge pull request #19494 from zeertzjq/vim-8.2.5155
vim-patch:8.2.{5155,5163,5164,5166}: diff fixes
Diffstat (limited to 'src/nvim/testdir/test_diffmode.vim')
-rw-r--r--src/nvim/testdir/test_diffmode.vim96
1 files changed, 95 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim
index 007b7e0f14..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
@@ -1378,4 +1379,97 @@ 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, "\<C-W>\<C-W>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
+
+" 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
+
+" 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