aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-24 21:13:32 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-09-24 21:16:43 +0800
commit57b731818d3d54dacdace081f6db4a8ce813173d (patch)
treea9b49cf3524d12368532697fffd81c7677ec3bcf /src/nvim/testdir
parent291a6496327e90056ea68085ad52ab74ca1df752 (diff)
downloadrneovim-57b731818d3d54dacdace081f6db4a8ce813173d.tar.gz
rneovim-57b731818d3d54dacdace081f6db4a8ce813173d.tar.bz2
rneovim-57b731818d3d54dacdace081f6db4a8ce813173d.zip
vim-patch:9.0.0567: 'completeopt' "longest" is not used for complete()
Problem: 'completeopt' "longest" is not used for complete(). Solution: Also use "longest" for complete(). (Bjorn Linse, closes vim/vim#11206) https://github.com/vim/vim/commit/87af60c91503e37c9144f8e48022b12994ce2c85
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_ins_complete.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim
index 3e563f29f9..0810bd4adc 100644
--- a/src/nvim/testdir/test_ins_complete.vim
+++ b/src/nvim/testdir/test_ins_complete.vim
@@ -702,6 +702,26 @@ func Test_recursive_complete_func()
bw!
endfunc
+" Test for using complete() with completeopt+=longest
+func Test_complete_with_longest()
+ inoremap <f3> <cmd>call complete(1, ["iaax", "iaay", "iaaz"])<cr>
+ new
+
+ " default: insert first match
+ set completeopt&
+ call setline(1, ['i'])
+ exe "normal Aa\<f3>\<esc>"
+ call assert_equal('iaax', getline(1))
+
+ " with longest: insert longest prefix
+ set completeopt+=longest
+ call setline(1, ['i'])
+ exe "normal Aa\<f3>\<esc>"
+ call assert_equal('iaa', getline(1))
+ set completeopt&
+endfunc
+
+
" Test for completing words following a completed word in a line
func Test_complete_wrapscan()
" complete words from another buffer