mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 00:38:17 +00:00
vim-patch:8.2.5022: 'completefunc'/'omnifunc' error does not end completion (#19083)
Problem: 'completefunc'/'omnifunc' error does not end completion.
Solution: Check if there was an error or exception. (closes vim/vim#10486,
closes vim/vim#4218)
9bcb9ca9c7
This commit is contained in:
@@ -5263,12 +5263,13 @@ static int ins_complete(int c, bool enable_pum)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return value -2 means the user complete function wants to
|
// Return value -2 means the user complete function wants to cancel the
|
||||||
* cancel the complete without an error.
|
// complete without an error, do the same if the function did not execute
|
||||||
* Return value -3 does the same as -2 and leaves CTRL-X mode.*/
|
// successfully.
|
||||||
if (col == -2) {
|
if (col == -2 || aborting()) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
// Return value -3 does the same as -2 and leaves CTRL-X mode.
|
||||||
if (col == -3) {
|
if (col == -3) {
|
||||||
ctrl_x_mode = CTRL_X_NORMAL;
|
ctrl_x_mode = CTRL_X_NORMAL;
|
||||||
edit_submode = NULL;
|
edit_submode = NULL;
|
||||||
|
@@ -287,6 +287,30 @@ func Test_omni_dash()
|
|||||||
set omnifunc=
|
set omnifunc=
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_omni_throw()
|
||||||
|
let g:CallCount = 0
|
||||||
|
func Omni(findstart, base)
|
||||||
|
let g:CallCount += 1
|
||||||
|
if a:findstart
|
||||||
|
throw "he he he"
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
set omnifunc=Omni
|
||||||
|
new
|
||||||
|
try
|
||||||
|
exe "normal ifoo\<C-x>\<C-o>"
|
||||||
|
call assert_false(v:true, 'command should have failed')
|
||||||
|
catch
|
||||||
|
call assert_exception('he he he')
|
||||||
|
call assert_equal(1, g:CallCount)
|
||||||
|
endtry
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
delfunc Omni
|
||||||
|
unlet g:CallCount
|
||||||
|
set omnifunc=
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_completefunc_args()
|
func Test_completefunc_args()
|
||||||
let s:args = []
|
let s:args = []
|
||||||
func! CompleteFunc(findstart, base)
|
func! CompleteFunc(findstart, base)
|
||||||
|
Reference in New Issue
Block a user