aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-13 18:04:39 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-02-13 18:17:25 -0500
commit54cd7298f8aa6adfa5a629b13ecb71b7779798bd (patch)
tree87e43c1069dc189a241f8fb834cb28871a0ef47f /src/nvim/testdir
parentfd44bd4d4feb884460fd9f023b162f5ee166aae0 (diff)
downloadrneovim-54cd7298f8aa6adfa5a629b13ecb71b7779798bd.tar.gz
rneovim-54cd7298f8aa6adfa5a629b13ecb71b7779798bd.tar.bz2
rneovim-54cd7298f8aa6adfa5a629b13ecb71b7779798bd.zip
vim-patch:8.2.0054: :diffget and :diffput don't have good completion
Problem: :diffget and :diffput don't have good completion. Solution: Add proper completion. (Dominique Pelle, closes vim/vim#5409) https://github.com/vim/vim/commit/ae7dba896975051a3f0b7123faa08dac5635972d
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_diffmode.vim40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_diffmode.vim b/src/nvim/testdir/test_diffmode.vim
index 8a4276b2a6..dd67806953 100644
--- a/src/nvim/testdir/test_diffmode.vim
+++ b/src/nvim/testdir/test_diffmode.vim
@@ -242,6 +242,46 @@ func Test_diffput_two()
bwipe! b
endfunc
+func Test_diffget_diffput_completion()
+ new Xdiff1 | diffthis
+ new Xdiff2 | diffthis
+ new Xdiff3 | diffthis
+ new Xdiff4
+
+ " :diffput and :diffget completes names of buffers which
+ " are in diff mode and which are different then current buffer.
+ b Xdiff1
+ call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffput Xdiff2 Xdiff3', @:)
+ call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffget Xdiff2 Xdiff3', @:)
+ call assert_equal(['Xdiff2', 'Xdiff3'], getcompletion('', 'diff_buffer'))
+
+ b Xdiff2
+ call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffput Xdiff1 Xdiff3', @:)
+ call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffget Xdiff1 Xdiff3', @:)
+ call assert_equal(['Xdiff1', 'Xdiff3'], getcompletion('', 'diff_buffer'))
+
+ b Xdiff3
+ call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffput Xdiff1 Xdiff2', @:)
+ call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffget Xdiff1 Xdiff2', @:)
+ call assert_equal(['Xdiff1', 'Xdiff2'], getcompletion('', 'diff_buffer'))
+
+ " No completion when in Xdiff4, it's not in diff mode.
+ b Xdiff4
+ call feedkeys(":diffput \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffput ', @:)
+ call feedkeys(":diffget \<C-A>\<C-B>\"\<CR>", 'tx')
+ call assert_equal('"diffget ', @:)
+ call assert_equal([], getcompletion('', 'diff_buffer'))
+
+ %bwipe
+endfunc
+
func Test_dp_do_buffer()
e! one
let bn1=bufnr('%')