Hi Bram and list,
How to reproduce:
- Prepare the following vim script file.
$ cat sample1.vim
function! Sample()
return 'autocmd '
endfunction
call feedkeys("i\<c-r>=Sample()\<CR>\<C-x>\<C-v>")
- Run vanilla vim with execute above file.
$ vim -Nu NONE -S sample1.vim
Expected behavior (I think):
Current line displayed `autocomd BufAdd` and popup menu is appeared.
Actual behavior:
completion is not performed.
Below message diplayed in last line.
"-- Command-line completion (^V^N^P) Pattern not found"
Is this bug?
I don't know. But I wrote a patch with a test.
Please check an attached patch.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 110a95a..7d58ed1 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4512,6 +4512,8 @@ set_cmd_context(
/* pass CMD_SIZE because there is no real command */
set_context_for_expression(xp, str, CMD_SIZE);
# endif
+ while (nextcomm != NULL)
+ nextcomm = set_one_cmd_context(xp, nextcomm);
}
else if (ccline.input_fn)
{
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 6db3bf7..767753f 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -172,6 +172,7 @@ func Test_augroup_warning()
augroup Another
augroup END
call assert_true(match(execute('au VimEnter'), "-Deleted-.*VimEnter") >= 0)
+ augroup! Another
" no warning for postpone aucmd delete
augroup StartOK
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 34a2251..cd87e00 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -236,22 +236,27 @@ func! Test_popup_completion_insertmode()
iunmap <F5>
endfunc
-function! ComplTest() abort
- call complete(1, ['source', 'soundfold'])
- return ''
-endfunction
-
func Test_noinsert_complete()
+ function! s:complTest1() abort
+ call complete(1, ['source', 'soundfold'])
+ return ''
+ endfunction
+
+ function! s:complTest2() abort
+ call complete(1, ['source', 'soundfold'])
+ return ''
+ endfunction
+
new
set completeopt+=noinsert
- inoremap <F5> <C-R>=ComplTest()<CR>
+ inoremap <F5> <C-R>=s:complTest1()<CR>
call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx')
call assert_equal('soundfold', getline(1))
call assert_equal('soundfold', getline(2))
bwipe!
new
- inoremap <F5> <C-R>=Test()<CR>
+ inoremap <F5> <C-R>=s:complTest2()<CR>
call feedkeys("i\<F5>\<CR>\<ESC>", 'tx')
call assert_equal('source', getline(1))
bwipe!
@@ -260,10 +265,17 @@ func Test_noinsert_complete()
iunmap <F5>
endfunc
+func Test_compl_vim_cmds_after_register_expr()
+ function! s:test_func()
+ return 'autocmd '
+ endfunction
-function! Test() abort
- call complete(1, ['source', 'soundfold'])
- return ''
-endfunction
+ new
+ call feedkeys("i\<c-r>=s:test_func()\<CR>\<C-x>\<C-v>\<Esc>", 'tx')
+ " When a new autocmd event is added before the 'BufAdd' in ascending order,
+ " we will be a need to change here.
+ call assert_equal('autocmd BufAdd', getline(1))
+ bwipe!
+endfunc
" vim: shiftwidth=2 sts=2 expandtab