diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-08 22:48:00 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-08 22:48:00 +0200 |
commit | 39de95257714b76ccd845d081cff57830a79b488 (patch) | |
tree | 31dff74e8b3ea716ff75fc766932fe0542c58268 /src/testdir/test_popup.vim | |
parent | 18cebf44177542e6658251bacf6152aa9009ca58 (diff) |
patch 8.0.1806: InsertCharPre causes problems for autocompletev8.0.1806
Problem: InsertCharPre causes problems for autocomplete. (Lifepillar)
Solution: Check for InsertCharPre before calling vpeekc(). (Christian
Brabandt, closes #2876)
Diffstat (limited to 'src/testdir/test_popup.vim')
-rw-r--r-- | src/testdir/test_popup.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index d682dd2110..89cdf0e8c1 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -831,4 +831,34 @@ func Test_popup_complete_backwards_ctrl_p() bwipe! endfunc +fun! Test_complete_o_tab() + let s:o_char_pressed = 0 + + fun! s:act_on_text_changed() + if s:o_char_pressed + let s:o_char_pressed = 0 + call feedkeys("\<c-x>\<c-n>", 'i') + endif + endf + + set completeopt=menu,noselect + new + imap <expr> <buffer> <tab> pumvisible() ? "\<c-p>" : "X" + autocmd! InsertCharPre <buffer> let s:o_char_pressed = (v:char ==# 'o') + autocmd! TextChangedI <buffer> call <sid>act_on_text_changed() + call setline(1, ['hoard', 'hoax', 'hoarse', '']) + let l:expected = ['hoard', 'hoax', 'hoarse', 'hoax', 'hoax'] + call cursor(4,1) + call test_override("char_avail", 1) + call feedkeys("Ahoa\<tab>\<tab>\<c-y>\<esc>", 'tx') + call feedkeys("oho\<tab>\<tab>\<c-y>\<esc>", 'tx') + call assert_equal(l:expected, getline(1,'$')) + + call test_override("char_avail", 0) + bwipe! + set completeopt& + delfunc s:act_on_text_changed +endf + + " vim: shiftwidth=2 sts=2 expandtab |