comparison src/testdir/test_ins_complete.vim @ 23770:385d33dfb7df v8.2.2426

patch 8.2.2426: allowing 'completefunc' to switch windows causes trouble Commit: https://github.com/vim/vim/commit/28976e2accf11591c60e8a658a9e03544f0408b2 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 29 21:07:07 2021 +0100 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".
author Bram Moolenaar <Bram@vim.org>
date Fri, 29 Jan 2021 21:15:04 +0100
parents 704fdd4d0949
children f5225486d3de
comparison
equal deleted inserted replaced
23769:3dd5ed701137 23770:385d33dfb7df
560 endfunc 560 endfunc
561 set completefunc=CompleteFunc2 561 set completefunc=CompleteFunc2
562 call setline(1, ['', 'abcd', '']) 562 call setline(1, ['', 'abcd', ''])
563 call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E578:') 563 call assert_fails('exe "normal 2G$a\<C-X>\<C-U>"', 'E578:')
564 564
565 set completefunc&
566 delfunc CompleteFunc
567 delfunc CompleteFunc2
568 close!
569 endfunc
570
571 func Test_completefunc_error_not_asan()
572 " The following test causes an ASAN failure.
573 CheckNotAsan
574
575 " Jump to a different window from the complete function 565 " Jump to a different window from the complete function
576 func! CompleteFunc(findstart, base) 566 func CompleteFunc3(findstart, base)
577 if a:findstart == 1 567 if a:findstart == 1
578 return col('.') - 1 568 return col('.') - 1
579 endif 569 endif
580 wincmd p 570 wincmd p
581 return ['a', 'b'] 571 return ['a', 'b']
582 endfunc 572 endfunc
583 set completefunc=CompleteFunc 573 set completefunc=CompleteFunc3
584 new 574 new
585 call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E839:') 575 call assert_fails('exe "normal a\<C-X>\<C-U>"', 'E565:')
586 close! 576 close!
587 577
588 set completefunc& 578 set completefunc&
589 delfunc CompleteFunc 579 delfunc CompleteFunc
580 delfunc CompleteFunc2
581 delfunc CompleteFunc3
582 close!
590 endfunc 583 endfunc
591 584
592 " Test for returning non-string values from 'completefunc' 585 " Test for returning non-string values from 'completefunc'
593 func Test_completefunc_invalid_data() 586 func Test_completefunc_invalid_data()
594 new 587 new