aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-24 21:42:18 +0800
committerGitHub <noreply@github.com>2022-09-24 21:42:18 +0800
commitdfc6c973a34b1d16d6e1ae135aff587366aeb083 (patch)
tree6a864981cd974b910cca1e387da8cf8ebcdda2be /src/nvim/testdir
parent291a6496327e90056ea68085ad52ab74ca1df752 (diff)
parent0c77dba9a46765c7a769090ae21433efea5bda00 (diff)
downloadrneovim-dfc6c973a34b1d16d6e1ae135aff587366aeb083.tar.gz
rneovim-dfc6c973a34b1d16d6e1ae135aff587366aeb083.tar.bz2
rneovim-dfc6c973a34b1d16d6e1ae135aff587366aeb083.zip
Merge pull request #20322 from zeertzjq/vim-9.0.0567
vim-patch:9.0.{0567,0572}: 'completeopt' "longest" is not used for complete()
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_ins_complete.vim23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim
index 3e563f29f9..f706322a85 100644
--- a/src/nvim/testdir/test_ins_complete.vim
+++ b/src/nvim/testdir/test_ins_complete.vim
@@ -702,6 +702,27 @@ func Test_recursive_complete_func()
bw!
endfunc
+" Test for using complete() with completeopt+=longest
+func Test_complete_with_longest()
+ new
+ inoremap <buffer> <f3> <cmd>call complete(1, ["iaax", "iaay", "iaaz"])<cr>
+
+ " 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&
+ bwipe!
+endfunc
+
+
" Test for completing words following a completed word in a line
func Test_complete_wrapscan()
" complete words from another buffer
@@ -1256,7 +1277,7 @@ endfunc
" A mapping is not used for the key after CTRL-X.
func Test_no_mapping_for_ctrl_x_key()
new
- inoremap <C-K> <Cmd>let was_mapped = 'yes'<CR>
+ inoremap <buffer> <C-K> <Cmd>let was_mapped = 'yes'<CR>
setlocal dictionary=README.txt
call feedkeys("aexam\<C-X>\<C-K> ", 'xt')
call assert_equal('example ', getline(1))