comparison src/testdir/test_ins_complete.vim @ 30473:1928947b8e1a v9.0.0572

patch 9.0.0572: insert complete tests leave a mapping behind Commit: https://github.com/vim/vim/commit/75f4bafabdcc6bce5cf3e09fee29c634bf102c17 Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Sep 24 14:08:23 2022 +0100 patch 9.0.0572: insert complete tests leave a mapping behind Problem: Insert complete tests leave a mapping behind. Solution: Use a buffer-local mapping. (closes https://github.com/vim/vim/issues/11211)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Sep 2022 15:15:03 +0200
parents faecc8c6916f
children 79e2d9b7780c
comparison
equal deleted inserted replaced
30472:9b141da86933 30473:1928947b8e1a
699 bw! 699 bw!
700 endfunc 700 endfunc
701 701
702 " Test for using complete() with completeopt+=longest 702 " Test for using complete() with completeopt+=longest
703 func Test_complete_with_longest() 703 func Test_complete_with_longest()
704 inoremap <f3> <cmd>call complete(1, ["iaax", "iaay", "iaaz"])<cr> 704 new
705 new 705 inoremap <buffer> <f3> <cmd>call complete(1, ["iaax", "iaay", "iaaz"])<cr>
706 706
707 " default: insert first match 707 " default: insert first match
708 set completeopt& 708 set completeopt&
709 call setline(1, ['i']) 709 call setline(1, ['i'])
710 exe "normal Aa\<f3>\<esc>" 710 exe "normal Aa\<f3>\<esc>"
714 set completeopt+=longest 714 set completeopt+=longest
715 call setline(1, ['i']) 715 call setline(1, ['i'])
716 exe "normal Aa\<f3>\<esc>" 716 exe "normal Aa\<f3>\<esc>"
717 call assert_equal('iaa', getline(1)) 717 call assert_equal('iaa', getline(1))
718 set completeopt& 718 set completeopt&
719 bwipe!
719 endfunc 720 endfunc
720 721
721 722
722 " Test for completing words following a completed word in a line 723 " Test for completing words following a completed word in a line
723 func Test_complete_wrapscan() 724 func Test_complete_wrapscan()
1270 endfunc 1271 endfunc
1271 1272
1272 " A mapping is not used for the key after CTRL-X. 1273 " A mapping is not used for the key after CTRL-X.
1273 func Test_no_mapping_for_ctrl_x_key() 1274 func Test_no_mapping_for_ctrl_x_key()
1274 new 1275 new
1275 inoremap <C-K> <Cmd>let was_mapped = 'yes'<CR> 1276 inoremap <buffer> <C-K> <Cmd>let was_mapped = 'yes'<CR>
1276 setlocal dictionary=README.txt 1277 setlocal dictionary=README.txt
1277 call feedkeys("aexam\<C-X>\<C-K> ", 'xt') 1278 call feedkeys("aexam\<C-X>\<C-K> ", 'xt')
1278 call assert_equal('example ', getline(1)) 1279 call assert_equal('example ', getline(1))
1279 call assert_false(exists('was_mapped')) 1280 call assert_false(exists('was_mapped'))
1280 bwipe! 1281 bwipe!