patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble
Problem: Allowing 'completefunc' to switch windows causes trouble.
Solution: use "textwinlock" instead of "textlock".
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index 5aa2664..489c1d9 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -562,31 +562,24 @@
call setline(1, ['', 'abcd', ''])
call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E578:')
- set completefunc&
- delfunc CompleteFunc
- delfunc CompleteFunc2
- close!
-endfunc
-
-func Test_completefunc_error_not_asan()
- " The following test causes an ASAN failure.
- CheckNotAsan
-
" Jump to a different window from the complete function
- func! CompleteFunc(findstart, base)
+ func CompleteFunc3(findstart, base)
if a:findstart == 1
return col('.') - 1
endif
wincmd p
return ['a', 'b']
endfunc
- set completefunc=CompleteFunc
+ set completefunc=CompleteFunc3
new
- call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E839:')
+ call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E565:')
close!
set completefunc&
delfunc CompleteFunc
+ delfunc CompleteFunc2
+ delfunc CompleteFunc3
+ close!
endfunc
" Test for returning non-string values from 'completefunc'
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 9175ff1..2d0625b 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -342,7 +342,7 @@
setlocal completefunc=DummyCompleteOne
call setline(1, 'one')
/^one
- call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E578:')
+ call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E565:')
call assert_equal(winid, win_getid())
call assert_equal('onedef', getline(1))
q!
@@ -642,8 +642,8 @@
set completefunc=MessComplete
new
call setline(1, 'Ju')
- call feedkeys("A\<c-x>\<c-u>/\<esc>", 'tx')
- call assert_equal('Oct/Oct', getline(1))
+ call assert_fails('call feedkeys("A\<c-x>\<c-u>/\<esc>", "tx")', 'E578:')
+ call assert_equal('Jan/', getline(1))
bwipe!
set completefunc=
endfunc