neovim/test/old/testdir/test_popup.vim

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

1333 lines
37 KiB
VimL
Raw Normal View History

" Test for completion menu
2018-08-25 22:00:26 -07:00
source shared.vim
source screendump.vim
source check.vim
2018-08-25 22:00:26 -07:00
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
let g:setting = ''
func ListMonths()
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
if g:setting != ''
exe ":set" g:setting
endif
let mth = copy(g:months)
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
let entered = strcharpart(getline('.'),0,col('.'))
if !empty(entered)
let mth = filter(mth, 'v:val=~"^".entered')
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
endif
call complete(1, mth)
return ''
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
endfunc
func Test_popup_complete2()
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" Although the popupmenu is not visible, this does not mean completion mode
" has ended. After pressing <f5> to complete the currently typed char, Vim
" still stays in the first state of the completion (:h ins-completion-menu),
" although the popupmenu wasn't shown <c-e> will remove the inserted
" completed text (:h complete_CTRL-E), while the following <c-e> will behave
" like expected (:h i_CTRL-E)
new
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
inoremap <f5> <c-r>=ListMonths()<cr>
call append(1, ["December2015"])
:1
call feedkeys("aD\<f5>\<C-E>\<C-E>\<C-E>\<C-E>\<enter>\<esc>", 'tx')
call assert_equal(["Dece", "", "December2015"], getline(1,3))
%d
bw!
endfunc
func Test_popup_complete()
new
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
inoremap <f5> <c-r>=ListMonths()<cr>
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" <C-E> - select original typed text before the completion started
call feedkeys("aJu\<f5>\<down>\<c-e>\<esc>", 'tx')
call assert_equal(["Ju"], getline(1,2))
%d
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" <C-Y> - accept current match
call feedkeys("a\<f5>". repeat("\<down>",7). "\<c-y>\<esc>", 'tx')
call assert_equal(["August"], getline(1,2))
%d
" <BS> - Delete one character from the inserted text (state: 1)
" TODO: This should not end the completion, but it does.
" This should according to the documentation:
" January
" but instead, this does
" Januar
" (idea is, C-L inserts the match from the popup menu
" but if the menu is closed, it will insert the character <c-l>
call feedkeys("aJ\<f5>\<bs>\<c-l>\<esc>", 'tx')
call assert_equal(["Januar "], getline(1,2))
%d
" any-non special character: Stop completion without changing the match
" and insert the typed character
call feedkeys("a\<f5>20", 'tx')
call assert_equal(["January20"], getline(1,2))
%d
" any-non printable, non-white character: Add this character and
" reduce number of matches
call feedkeys("aJu\<f5>\<c-p>l\<c-y>", 'tx')
call assert_equal(["Jul"], getline(1,2))
%d
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" any-non printable, non-white character: Add this character and
" reduce number of matches
call feedkeys("aJu\<f5>\<c-p>l\<c-n>\<c-y>", 'tx')
call assert_equal(["July"], getline(1,2))
%d
" any-non printable, non-white character: Add this character and
" reduce number of matches
call feedkeys("aJu\<f5>\<c-p>l\<c-e>", 'tx')
call assert_equal(["Jul"], getline(1,2))
%d
" <BS> - Delete one character from the inserted text (state: 2)
call feedkeys("a\<f5>\<c-n>\<bs>", 'tx')
call assert_equal(["Februar"], getline(1,2))
%d
" <c-l> - Insert one character from the current match
call feedkeys("aJ\<f5>".repeat("\<c-n>",3)."\<c-l>\<esc>", 'tx')
call assert_equal(["J "], getline(1,2))
%d
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" <c-l> - Insert one character from the current match
call feedkeys("aJ\<f5>".repeat("\<c-n>",4)."\<c-l>\<esc>", 'tx')
call assert_equal(["January "], getline(1,2))
%d
" <c-y> - Accept current selected match
call feedkeys("aJ\<f5>\<c-y>\<esc>", 'tx')
call assert_equal(["January"], getline(1,2))
%d
" <c-e> - End completion, go back to what was there before selecting a match
call feedkeys("aJu\<f5>\<c-e>\<esc>", 'tx')
call assert_equal(["Ju"], getline(1,2))
%d
" <PageUp> - Select a match several entries back
call feedkeys("a\<f5>\<PageUp>\<c-y>\<esc>", 'tx')
call assert_equal([""], getline(1,2))
%d
" <PageUp><PageUp> - Select a match several entries back
call feedkeys("a\<f5>\<PageUp>\<PageUp>\<c-y>\<esc>", 'tx')
call assert_equal(["December"], getline(1,2))
%d
" <PageUp><PageUp><PageUp> - Select a match several entries back
call feedkeys("a\<f5>\<PageUp>\<PageUp>\<PageUp>\<c-y>\<esc>", 'tx')
call assert_equal(["February"], getline(1,2))
%d
" <PageDown> - Select a match several entries further
call feedkeys("a\<f5>\<PageDown>\<c-y>\<esc>", 'tx')
call assert_equal(["November"], getline(1,2))
%d
" <PageDown><PageDown> - Select a match several entries further
call feedkeys("a\<f5>\<PageDown>\<PageDown>\<c-y>\<esc>", 'tx')
call assert_equal(["December"], getline(1,2))
%d
" <PageDown><PageDown><PageDown> - Select a match several entries further
call feedkeys("a\<f5>\<PageDown>\<PageDown>\<PageDown>\<c-y>\<esc>", 'tx')
call assert_equal([""], getline(1,2))
%d
" <PageDown><PageDown><PageDown><PageDown> - Select a match several entries further
call feedkeys("a\<f5>".repeat("\<PageDown>",4)."\<c-y>\<esc>", 'tx')
call assert_equal(["October"], getline(1,2))
%d
" <Up> - Select a match don't insert yet
call feedkeys("a\<f5>\<Up>\<c-y>\<esc>", 'tx')
call assert_equal([""], getline(1,2))
%d
" <Up><Up> - Select a match don't insert yet
call feedkeys("a\<f5>\<Up>\<Up>\<c-y>\<esc>", 'tx')
call assert_equal(["December"], getline(1,2))
%d
" <Up><Up><Up> - Select a match don't insert yet
call feedkeys("a\<f5>\<Up>\<Up>\<Up>\<c-y>\<esc>", 'tx')
call assert_equal(["November"], getline(1,2))
%d
" <Tab> - Stop completion and insert the match
call feedkeys("a\<f5>\<Tab>\<c-y>\<esc>", 'tx')
call assert_equal(["January "], getline(1,2))
%d
" <Space> - Stop completion and insert the match
call feedkeys("a\<f5>".repeat("\<c-p>",5)." \<esc>", 'tx')
call assert_equal(["September "], getline(1,2))
%d
" <Enter> - Use the text and insert line break (state: 1)
call feedkeys("a\<f5>\<enter>\<esc>", 'tx')
call assert_equal(["January", ''], getline(1,2))
%d
" <Enter> - Insert the current selected text (state: 2)
call feedkeys("a\<f5>".repeat("\<Up>",5)."\<enter>\<esc>", 'tx')
call assert_equal(["September"], getline(1,2))
%d
" Insert match immediately, if there is only one match
" <c-y> selects a character from the line above
call append(0, ["December2015"])
call feedkeys("aD\<f5>\<C-Y>\<C-Y>\<C-Y>\<C-Y>\<enter>\<esc>", 'tx')
call assert_equal(["December2015", "December2015", ""], getline(1,3))
%d
" use menuone for 'completeopt'
" Since for the first <c-y> the menu is still shown, will only select
" three letters from the line above
set completeopt&vim
set completeopt+=menuone
call append(0, ["December2015"])
call feedkeys("aD\<f5>\<C-Y>\<C-Y>\<C-Y>\<C-Y>\<enter>\<esc>", 'tx')
call assert_equal(["December2015", "December201", ""], getline(1,3))
%d
" use longest for 'completeopt'
set completeopt&vim
call feedkeys("aM\<f5>\<C-N>\<C-P>\<c-e>\<enter>\<esc>", 'tx')
set completeopt+=longest
call feedkeys("aM\<f5>\<C-N>\<C-P>\<c-e>\<enter>\<esc>", 'tx')
call assert_equal(["M", "Ma", ""], getline(1,3))
%d
" use noselect/noinsert for 'completeopt'
set completeopt&vim
call feedkeys("aM\<f5>\<enter>\<esc>", 'tx')
set completeopt+=noselect
call feedkeys("aM\<f5>\<enter>\<esc>", 'tx')
set completeopt-=noselect completeopt+=noinsert
call feedkeys("aM\<f5>\<enter>\<esc>", 'tx')
call assert_equal(["March", "M", "March"], getline(1,4))
%d
endfunc
func Test_popup_completion_insertmode()
new
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
inoremap <F5> <C-R>=ListMonths()<CR>
call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx')
call assert_equal('February', getline(1))
%d
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" Set noinsertmode
let g:setting = 'noinsertmode'
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx')
call assert_equal('February', getline(1))
call assert_false(pumvisible())
%d
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" Go through all matches, until none is selected
let g:setting = ''
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
call feedkeys("a\<f5>". repeat("\<c-n>",12)."\<enter>\<esc>", 'tx')
call assert_equal('', getline(1))
%d
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" select previous entry
call feedkeys("a\<f5>\<c-p>\<enter>\<esc>", 'tx')
call assert_equal('', getline(1))
%d
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" select last entry
call feedkeys("a\<f5>\<c-p>\<c-p>\<enter>\<esc>", 'tx')
call assert_equal('December', getline(1))
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
iunmap <F5>
endfunc
func Test_noinsert_complete()
func! s:complTest1() abort
eval ['source', 'soundfold']->complete(1)
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
return ''
endfunc
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
func! s:complTest2() abort
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
call complete(1, ['source', 'soundfold'])
return ''
endfunc
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
new
set completeopt+=noinsert
inoremap <F5> <C-R>=s:complTest1()<CR>
call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx')
call assert_equal('soundfold', getline(1))
call assert_equal('soundfold', getline(2))
bwipe!
new
inoremap <F5> <C-R>=s:complTest2()<CR>
call feedkeys("i\<F5>\<CR>\<ESC>", 'tx')
call assert_equal('source', getline(1))
bwipe!
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
set completeopt-=noinsert
iunmap <F5>
endfunc
func Test_complete_no_filter()
func! s:complTest1() abort
call complete(1, [{'word': 'foobar'}])
return ''
endfunc
func! s:complTest2() abort
call complete(1, [{'word': 'foobar', 'equal': 1}])
return ''
endfunc
let completeopt = &completeopt
" without equal=1
new
set completeopt=menuone,noinsert,menu
inoremap <F5> <C-R>=s:complTest1()<CR>
call feedkeys("i\<F5>z\<CR>\<CR>\<ESC>.", 'tx')
call assert_equal('z', getline(1))
bwipe!
" with equal=1
new
set completeopt=menuone,noinsert,menu
inoremap <F5> <C-R>=s:complTest2()<CR>
call feedkeys("i\<F5>z\<CR>\<CR>\<ESC>.", 'tx')
call assert_equal('foobar', getline(1))
bwipe!
let &completeopt = completeopt
iunmap <F5>
endfunc
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
func Test_compl_vim_cmds_after_register_expr()
func! s:test_func()
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
return 'autocmd '
endfunc
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
augroup AAAAA_Group
au!
augroup END
new
call feedkeys("i\<c-r>=s:test_func()\<CR>\<C-x>\<C-v>\<Esc>", 'tx')
call assert_equal('autocmd AAAAA_Group', getline(1))
autocmd! AAAAA_Group
augroup! AAAAA_Group
bwipe!
endfunc
func Test_compl_ignore_mappings()
call setline(1, ['foo', 'bar', 'baz', 'foobar'])
inoremap <C-P> (C-P)
inoremap <C-N> (C-N)
normal! G
call feedkeys("o\<C-X>\<C-N>\<C-N>\<C-N>\<C-P>\<C-N>\<C-Y>", 'tx')
call assert_equal('baz', getline('.'))
" Also test with unsimplified keys
call feedkeys("o\<C-X>\<*C-N>\<*C-N>\<*C-N>\<*C-P>\<*C-N>\<C-Y>", 'tx')
call assert_equal('baz', getline('.'))
iunmap <C-P>
iunmap <C-N>
bwipe!
endfunc
func DummyCompleteOne(findstart, base)
if a:findstart
return 0
else
wincmd n
return ['onedef', 'oneDEF']
endif
endfunc
" Test that nothing happens if the 'completefunc' tries to open
" a new window (fails to open window, continues)
func Test_completefunc_opens_new_window_one()
new
let winid = win_getid()
setlocal completefunc=DummyCompleteOne
call setline(1, 'one')
/^one
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!
endfunc
" Test that nothing happens if the 'completefunc' opens
" a new window (no completion, no crash)
func DummyCompleteTwo(findstart, base)
if a:findstart
wincmd n
return 0
else
return ['twodef', 'twoDEF']
endif
endfunc
" Test that nothing happens if the 'completefunc' opens
" a new window (no completion, no crash)
func Test_completefunc_opens_new_window_two()
new
let winid = win_getid()
setlocal completefunc=DummyCompleteTwo
call setline(1, 'two')
/^two
call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E565:')
call assert_equal(winid, win_getid())
call assert_equal('twodef', getline(1))
q!
endfunc
func DummyCompleteThree(findstart, base)
if a:findstart
return 0
else
return ['threedef', 'threeDEF']
endif
endfunc
:"Test that 'completefunc' works when it's OK.
func Test_completefunc_works()
new
let winid = win_getid()
setlocal completefunc=DummyCompleteThree
call setline(1, 'three')
/^three
call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")
call assert_equal(winid, win_getid())
call assert_equal('threeDEF', getline(1))
q!
endfunc
func DummyCompleteFour(findstart, base)
if a:findstart
return 0
else
call complete_add('four1')
eval 'four2'->complete_add()
call complete_check()
call complete_add('four3')
call complete_add('four4')
call complete_check()
call complete_add('four5')
call complete_add('four6')
return []
endif
endfunc
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
" Test that 'omnifunc' works when it's OK.
func Test_omnifunc_with_check()
new
setlocal omnifunc=DummyCompleteFour
call setline(1, 'four')
/^four
call feedkeys("A\<C-X>\<C-O>\<C-N>\<Esc>", "x")
call assert_equal('four2', getline(1))
call setline(1, 'four')
/^four
call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<Esc>", "x")
call assert_equal('four3', getline(1))
call setline(1, 'four')
/^four
call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<C-N>\<C-N>\<Esc>", "x")
call assert_equal('four5', getline(1))
q!
endfunc
func UndoComplete()
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
call complete(1, ['January', 'February', 'March',
\ 'April', 'May', 'June', 'July', 'August', 'September',
\ 'October', 'November', 'December'])
return ''
endfunc
" Test that no undo item is created when no completion is inserted
func Test_complete_no_undo()
set completeopt=menu,preview,noinsert,noselect
inoremap <Right> <C-R>=UndoComplete()<CR>
new
call feedkeys("ixxx\<CR>\<CR>yyy\<Esc>k", 'xt')
call feedkeys("iaaa\<Esc>0", 'xt')
call assert_equal('aaa', getline(2))
call feedkeys("i\<Right>\<Esc>", 'xt')
call assert_equal('aaa', getline(2))
call feedkeys("u", 'xt')
call assert_equal('', getline(2))
call feedkeys("ibbb\<Esc>0", 'xt')
call assert_equal('bbb', getline(2))
call feedkeys("A\<Right>\<Down>\<CR>\<Esc>", 'xt')
call assert_equal('January', getline(2))
call feedkeys("u", 'xt')
call assert_equal('bbb', getline(2))
call feedkeys("A\<Right>\<C-N>\<Esc>", 'xt')
call assert_equal('January', getline(2))
call feedkeys("u", 'xt')
call assert_equal('bbb', getline(2))
iunmap <Right>
set completeopt&
q!
endfunc
func DummyCompleteFive(findstart, base)
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
if a:findstart
return 0
else
return [
\ { 'word': 'January', 'info': "info1-1\n1-2\n1-3" },
\ { 'word': 'February', 'info': "info2-1\n2-2\n2-3" },
\ { 'word': 'March', 'info': "info3-1\n3-2\n3-3" },
\ { 'word': 'April', 'info': "info4-1\n4-2\n4-3" },
\ { 'word': 'May', 'info': "info5-1\n5-2\n5-3" },
\ ]
endif
endfunc
" Test that 'completefunc' on Scratch buffer with preview window works when
" it's OK.
func Test_completefunc_with_scratch_buffer()
new +setlocal\ buftype=nofile\ bufhidden=wipe\ noswapfile
set completeopt+=preview
setlocal completefunc=DummyCompleteFive
call feedkeys("A\<C-X>\<C-U>\<C-N>\<C-N>\<C-N>\<Esc>", "x")
call assert_equal(['April'], getline(1, '$'))
pclose
q!
set completeopt&
endfunc
" <C-E> - select original typed text before the completion started without
" auto-wrap text.
func Test_completion_ctrl_e_without_autowrap()
new
let tw_save = &tw
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
set tw=78
let li = [
\ '" zzz',
\ '" zzzyyyyyyyyyyyyyyyyyyy']
call setline(1, li)
0
call feedkeys("A\<C-X>\<C-N>\<C-E>\<Esc>", "tx")
call assert_equal(li, getline(1, '$'))
let &tw = tw_save
vim-patch:0 completion-related patches #5745 #5829 vim-patch:8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) https://github.com/vim/vim/commit/91e44a3305ef6bf2d43496c351dcff0a45c6bfb8 vim-patch:8.0.0099 Problem: Popup menu always appears above the cursor when it is in the lower half of the screen. (Matt Gardner) Solution: Compute the available space better. (Hirohito Higashi, closes vim/vim#1241) https://github.com/vim/vim/commit/73095288da839f7c738a49baa109773e76106806 vim-patch:8.0.0127 Problem: Cancelling completion still inserts text when formatting is done for 'textwidth'. (lacygoill) Solution: Don't format when CTRL-E was typed. (Hirohito Higashi, closes vim/vim#1312) https://github.com/vim/vim/commit/73fd4988866c3adc15b5d093efdf5e8cf70d093d vim-patch:7.4.2188 Problem: Completion does not work properly with some plugins. Solution: Revert the part related to typing CTRL-E. (closes vim/vim#972) https://github.com/vim/vim/commit/c9fb77c69244870a97384152f20845665c19fe39 vim-patch:7.4.2146 Problem: Not enough testing for popup menu. CTRL-E does not always work properly. Solution: Add more tests. When using CTRL-E check if the popup menu is visible. (Christian Brabandt) https://github.com/vim/vim/commit/472472898ab71ac80a86fedc37f8eb91461788dd vim-patch:7.4.2147 Problem: test_alot fails. Solution: Close window. https://github.com/vim/vim/commit/abb71fbd399772d467aaa7b34b958b0f975c7e65 vim-patch:7.4.2149 Problem: If a test leaves a window open a following test may fail. Solution: Always close extra windows after running a test. https://github.com/vim/vim/commit/7cba71d7e3576639679b6a3aedeeb1ac07f7f2f5 vim-patch:7.4.2321 Problem: When a test is commented out we forget about it. Solution: Let a test throw an exception with "Skipped" and list skipped test functions. (Christian Brabandt) https://github.com/vim/vim/commit/dac1947bb366ef43cd6da95acc730554e76d8b84 vim-patch:7.4.2331 Problem: Using CTRL-X CTRL-V to complete a command line from Insert mode does not work after entering an expression on the command line. Solution: Don't use "ccline" when not actually using a command line. (test by Hirohito Higashi) https://github.com/vim/vim/commit/33a80eeb859a78ba93432da6fa585786cfd77249 vim-patch:8.0.0008 Problem: Popup complete test is disabled. Solution: Enable the test and change the assert. (Hirohito Higashi) https://github.com/vim/vim/commit/9e02cfa226b2577ec867b544a1a450a428a19880 vim-patch:8.0.0047 Problem: Crash when using the preview window from an unnamed buffer. (lifepillar) Solution: Do not clear the wrong buffer. (closes vim/vim#1200) https://github.com/vim/vim/commit/50e5376926dc2ec4a26a7a16f8f0f3213c4afdf0 vim-patch:8.0.0053 Problem: No test for what 8.0.0047 fixes. Solution: Add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/60ef3e81f4a54d9f7ee617d57021f0811ec8ada5
2016-12-10 01:02:02 -07:00
q!
endfunc
func DummyCompleteSix()
call complete(1, ['Hello', 'World'])
return ''
endfunction
" complete() correctly clears the list of autocomplete candidates
" See #1411
func Test_completion_clear_candidate_list()
new
%d
" select first entry from the completion popup
call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>", "tx")
call assert_equal('Hello', getline(1))
%d
" select second entry from the completion popup
call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>", "tx")
call assert_equal('World', getline(1))
%d
" select original text
call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>\<C-N>", "tx")
call assert_equal(' xxx', getline(1))
%d
" back at first entry from completion list
call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>\<C-N>\<C-N>", "tx")
call assert_equal('Hello', getline(1))
bw!
endfunc
func Test_completion_respect_bs_option()
new
let li = ["aaa", "aaa12345", "aaaabcdef", "aaaABC"]
set bs=indent,eol
call setline(1, li)
1
call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
call assert_equal('aaa', getline(1))
%d
set bs=indent,eol,start
call setline(1, li)
1
call feedkeys("A\<C-X>\<C-N>\<C-P>\<BS>\<BS>\<BS>\<Esc>", "tx")
call assert_equal('', getline(1))
bw!
endfunc
func CompleteUndo() abort
call complete(1, g:months)
return ''
endfunc
func Test_completion_can_undo()
inoremap <Right> <c-r>=CompleteUndo()<cr>
set completeopt+=noinsert,noselect
new
call feedkeys("a\<Right>a\<Esc>", 'xt')
call assert_equal('a', getline(1))
undo
call assert_equal('', getline(1))
bwipe!
set completeopt&
iunmap <Right>
endfunc
func Test_completion_comment_formatting()
new
setl formatoptions=tcqro
call feedkeys("o/*\<cr>\<cr>/\<esc>", 'tx')
call assert_equal(['', '/*', ' *', ' */'], getline(1,4))
%d
call feedkeys("o/*\<cr>foobar\<cr>/\<esc>", 'tx')
call assert_equal(['', '/*', ' * foobar', ' */'], getline(1,4))
%d
try
call feedkeys("o/*\<cr>\<cr>\<c-x>\<c-u>/\<esc>", 'tx')
call assert_report('completefunc not set, should have failed')
catch
call assert_exception('E764:')
endtry
call assert_equal(['', '/*', ' *', ' */'], getline(1,4))
bwipe!
endfunc
func MessCompleteMonths()
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep")
call complete_add(m)
if complete_check()
break
endif
endfor
return []
endfunc
func MessCompleteMore()
call complete(1, split("Oct Nov Dec"))
return []
endfunc
func MessComplete(findstart, base)
if a:findstart
let line = getline('.')
let start = col('.') - 1
while start > 0 && line[start - 1] =~ '\a'
let start -= 1
endwhile
return start
else
call MessCompleteMonths()
call MessCompleteMore()
return []
endif
endfunc
func Test_complete_func_mess()
" Calling complete() after complete_add() in 'completefunc' is wrong, but it
" should not crash.
set completefunc=MessComplete
new
call setline(1, 'Ju')
call assert_fails('call feedkeys("A\<c-x>\<c-u>/\<esc>", "tx")', 'E565:')
call assert_equal('Jan/', getline(1))
bwipe!
set completefunc=
endfunc
func Test_complete_CTRLN_startofbuffer()
new
call setline(1, [ 'organize(cupboard, 3, 2);',
\ 'prioritize(bureau, 8, 7);',
\ 'realize(bannister, 4, 4);',
\ 'moralize(railing, 3,9);'])
let expected=['cupboard.organize(3, 2);',
\ 'bureau.prioritize(8, 7);',
\ 'bannister.realize(4, 4);',
\ 'railing.moralize(3,9);']
call feedkeys("qai\<c-n>\<c-n>.\<esc>3wdW\<cr>q3@a", 'tx')
call assert_equal(expected, getline(1,'$'))
bwipe!
endfunc
2018-08-25 22:00:26 -07:00
func Test_popup_and_window_resize()
CheckFeature terminal
CheckNotGui
2018-08-25 22:00:26 -07:00
let h = winheight(0)
if h < 15
return
endif
let rows = h / 3
let buf = term_start([GetVimProg(), '--clean', '-c', 'set noswapfile'], {'term_rows': rows})
call term_sendkeys(buf, (h / 3 - 1) . "o\<esc>")
" Wait for the nested Vim to exit insert mode, where it will show the ruler.
" Need to trigger a redraw.
call WaitFor({-> execute("redraw") == "" && term_getline(buf, rows) =~ '\<' . rows . ',.*Bot'})
call term_sendkeys(buf, "Gi\<c-x>")
call term_sendkeys(buf, "\<c-v>")
call term_wait(buf, 100)
" popup first entry "!" must be at the top
call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, 1))})
2018-08-25 22:00:26 -07:00
exe 'resize +' . (h - 1)
call term_wait(buf, 100)
2018-08-25 22:00:26 -07:00
redraw!
" popup shifted down, first line is now empty
call WaitForAssert({-> assert_equal('', term_getline(buf, 1))})
2018-08-25 22:00:26 -07:00
sleep 100m
" popup is below cursor line and shows first match "!"
call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1))})
" cursor line also shows !
call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0]))
2018-08-25 22:00:26 -07:00
bwipe!
endfunc
func Test_popup_and_preview_autocommand()
" This used to crash Vim
if !has('python')
return
endif
let h = winheight(0)
if h < 15
return
endif
new
augroup MyBufAdd
au!
au BufAdd * nested tab sball
augroup END
set omnifunc=pythoncomplete#Complete
call setline(1, 'import os')
" make the line long
call setline(2, ' os.')
$
call feedkeys("A\<C-X>\<C-O>\<C-N>\<C-N>\<C-N>\<enter>\<esc>", 'tx')
call assert_equal("import os", getline(1))
call assert_match(' os.\(EX_IOERR\|O_CREAT\)$', getline(2))
call assert_equal(1, winnr('$'))
" previewwindow option is not set
call assert_equal(0, &previewwindow)
norm! gt
call assert_equal(0, &previewwindow)
norm! gT
call assert_equal(10, tabpagenr('$'))
tabonly
pclose
augroup MyBufAdd
au!
augroup END
augroup! MyBufAdd
bw!
endfunc
func Test_popup_and_previewwindow_dump()
vim-patch:8.2.0462: previewwindow test fails on some systems Problem: Previewwindow test fails on some systems. (James McCoy) Solution: Wait a bit after sending the "o". (closes vim/vim#5849) https://github.com/vim/vim/commit/37bb030cd9088ee66dc2d41c2d3602d1e5f4a7ef Cherry-pick Test_popup_and_previewwindow_dump() changes from patches 8.1.1585, 8.1.2373. N/A patches for version.c: vim-patch:8.2.0242: preview popup window test fails with long directory name Problem: Preview popup window test fails with long directory name. (Jakub Kądziołka) Solution: Use "silent cd". (closes vim/vim#5615) https://github.com/vim/vim/commit/799439a5d85a7d45eff7485056f2798cea766300 vim-patch:8.2.2042: build failure with +profile but without +reltime Problem: Build failure with +profile but without +reltime. Solution: Adjust #ifdef. (Christian Brabandt, closes vim/vim#7361) https://github.com/vim/vim/commit/813196784ad2a3a8cd65be5e975769d9768a728e vim-patch:8.2.2043: GTK3: white border around text stands out Problem: GTK3: white border around text stands out. Solution: Use current theme color. (closes vim/vim#7357, issue vim/vim#349) https://github.com/vim/vim/commit/ff94bd9e4779b918f3761035f43a97ba7175b3ce vim-patch:8.2.2047: Amiga: FEAT_ARP defined when it should not Problem: Amiga: FEAT_ARP defined when it should not. Solution: Adjust #ifdef. (Ola Söder, closes vim/vim#7370) https://github.com/vim/vim/commit/36fe7b287e13a7534c9aa6dcf0c3d7f8363f6060 vim-patch:8.2.2048: Amiga: obsolete code Problem: Amiga: obsolete code. Solution: Remove the unused lines. (Ola Söder, closes vim/vim#7373) https://github.com/vim/vim/commit/3a3b6910421ee1d03c222efc62d61b9fb879d931 vim-patch:8.2.2049: Amiga: obsolete function Problem: Amiga: obsolete function. Solution: Remove the function. (Ola Söder, closes vim/vim#7374) https://github.com/vim/vim/commit/d653293c806c8bea976737b88006264e7a8ea6d6 vim-patch:8.2.2054: Amiga: FEAT_ARP defined when it should not Problem: Amiga: FEAT_ARP defined when it should not. Solution: Adjust "||" to "&&" in #ifdef. (Ola Söder, closes vim/vim#7375) https://github.com/vim/vim/commit/d49a35a1c3b736637733b36011fccbee7ef43fcf
2020-11-25 19:59:54 -07:00
CheckScreendump
CheckFeature quickfix
let lines =<< trim END
set previewheight=9
silent! pedit
call setline(1, map(repeat(["ab"], 10), "v:val .. v:key"))
exec "norm! G\<C-E>\<C-E>"
END
call writefile(lines, 'Xscript')
let buf = RunVimInTerminal('-S Xscript', {})
vim-patch:8.2.0462: previewwindow test fails on some systems Problem: Previewwindow test fails on some systems. (James McCoy) Solution: Wait a bit after sending the "o". (closes vim/vim#5849) https://github.com/vim/vim/commit/37bb030cd9088ee66dc2d41c2d3602d1e5f4a7ef Cherry-pick Test_popup_and_previewwindow_dump() changes from patches 8.1.1585, 8.1.2373. N/A patches for version.c: vim-patch:8.2.0242: preview popup window test fails with long directory name Problem: Preview popup window test fails with long directory name. (Jakub Kądziołka) Solution: Use "silent cd". (closes vim/vim#5615) https://github.com/vim/vim/commit/799439a5d85a7d45eff7485056f2798cea766300 vim-patch:8.2.2042: build failure with +profile but without +reltime Problem: Build failure with +profile but without +reltime. Solution: Adjust #ifdef. (Christian Brabandt, closes vim/vim#7361) https://github.com/vim/vim/commit/813196784ad2a3a8cd65be5e975769d9768a728e vim-patch:8.2.2043: GTK3: white border around text stands out Problem: GTK3: white border around text stands out. Solution: Use current theme color. (closes vim/vim#7357, issue vim/vim#349) https://github.com/vim/vim/commit/ff94bd9e4779b918f3761035f43a97ba7175b3ce vim-patch:8.2.2047: Amiga: FEAT_ARP defined when it should not Problem: Amiga: FEAT_ARP defined when it should not. Solution: Adjust #ifdef. (Ola Söder, closes vim/vim#7370) https://github.com/vim/vim/commit/36fe7b287e13a7534c9aa6dcf0c3d7f8363f6060 vim-patch:8.2.2048: Amiga: obsolete code Problem: Amiga: obsolete code. Solution: Remove the unused lines. (Ola Söder, closes vim/vim#7373) https://github.com/vim/vim/commit/3a3b6910421ee1d03c222efc62d61b9fb879d931 vim-patch:8.2.2049: Amiga: obsolete function Problem: Amiga: obsolete function. Solution: Remove the function. (Ola Söder, closes vim/vim#7374) https://github.com/vim/vim/commit/d653293c806c8bea976737b88006264e7a8ea6d6 vim-patch:8.2.2054: Amiga: FEAT_ARP defined when it should not Problem: Amiga: FEAT_ARP defined when it should not. Solution: Adjust "||" to "&&" in #ifdef. (Ola Söder, closes vim/vim#7375) https://github.com/vim/vim/commit/d49a35a1c3b736637733b36011fccbee7ef43fcf
2020-11-25 19:59:54 -07:00
" wait for the script to finish
call term_wait(buf)
" Test that popup and previewwindow do not overlap.
vim-patch:8.2.0462: previewwindow test fails on some systems Problem: Previewwindow test fails on some systems. (James McCoy) Solution: Wait a bit after sending the "o". (closes vim/vim#5849) https://github.com/vim/vim/commit/37bb030cd9088ee66dc2d41c2d3602d1e5f4a7ef Cherry-pick Test_popup_and_previewwindow_dump() changes from patches 8.1.1585, 8.1.2373. N/A patches for version.c: vim-patch:8.2.0242: preview popup window test fails with long directory name Problem: Preview popup window test fails with long directory name. (Jakub Kądziołka) Solution: Use "silent cd". (closes vim/vim#5615) https://github.com/vim/vim/commit/799439a5d85a7d45eff7485056f2798cea766300 vim-patch:8.2.2042: build failure with +profile but without +reltime Problem: Build failure with +profile but without +reltime. Solution: Adjust #ifdef. (Christian Brabandt, closes vim/vim#7361) https://github.com/vim/vim/commit/813196784ad2a3a8cd65be5e975769d9768a728e vim-patch:8.2.2043: GTK3: white border around text stands out Problem: GTK3: white border around text stands out. Solution: Use current theme color. (closes vim/vim#7357, issue vim/vim#349) https://github.com/vim/vim/commit/ff94bd9e4779b918f3761035f43a97ba7175b3ce vim-patch:8.2.2047: Amiga: FEAT_ARP defined when it should not Problem: Amiga: FEAT_ARP defined when it should not. Solution: Adjust #ifdef. (Ola Söder, closes vim/vim#7370) https://github.com/vim/vim/commit/36fe7b287e13a7534c9aa6dcf0c3d7f8363f6060 vim-patch:8.2.2048: Amiga: obsolete code Problem: Amiga: obsolete code. Solution: Remove the unused lines. (Ola Söder, closes vim/vim#7373) https://github.com/vim/vim/commit/3a3b6910421ee1d03c222efc62d61b9fb879d931 vim-patch:8.2.2049: Amiga: obsolete function Problem: Amiga: obsolete function. Solution: Remove the function. (Ola Söder, closes vim/vim#7374) https://github.com/vim/vim/commit/d653293c806c8bea976737b88006264e7a8ea6d6 vim-patch:8.2.2054: Amiga: FEAT_ARP defined when it should not Problem: Amiga: FEAT_ARP defined when it should not. Solution: Adjust "||" to "&&" in #ifdef. (Ola Söder, closes vim/vim#7375) https://github.com/vim/vim/commit/d49a35a1c3b736637733b36011fccbee7ef43fcf
2020-11-25 19:59:54 -07:00
call term_sendkeys(buf, "o")
call term_wait(buf, 100)
call term_sendkeys(buf, "\<C-X>\<C-N>")
call VerifyScreenDump(buf, 'Test_popup_and_previewwindow_01', {})
call term_sendkeys(buf, "\<Esc>u")
call StopVimInTerminal(buf)
call delete('Xscript')
endfunc
func Test_balloon_split()
CheckFunction balloon_split
call assert_equal([
\ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"',
\ ], balloon_split(
\ 'tempname: 0x555555e380a0 "/home/mool/.viminfz.tmp"'))
call assert_equal([
\ 'one two three four one two three four one two thre',
\ 'e four',
\ ], balloon_split(
\ 'one two three four one two three four one two three four'))
eval 'struct = {one = 1, two = 2, three = 3}'
\ ->balloon_split()
\ ->assert_equal([
\ 'struct = {',
\ ' one = 1,',
\ ' two = 2,',
\ ' three = 3}',
\ ])
call assert_equal([
\ 'struct = {',
\ ' one = 1,',
\ ' nested = {',
\ ' n1 = "yes",',
\ ' n2 = "no"}',
\ ' two = 2}',
\ ], balloon_split(
\ 'struct = {one = 1, nested = {n1 = "yes", n2 = "no"} two = 2}'))
call assert_equal([
\ 'struct = 0x234 {',
\ ' long = 2343 "\\"some long string that will be wr',
\ 'apped in two\\"",',
\ ' next = 123}',
\ ], balloon_split(
\ 'struct = 0x234 {long = 2343 "\\"some long string that will be wrapped in two\\"", next = 123}'))
call assert_equal([
\ 'Some comment',
\ '',
\ 'typedef this that;',
\ ], balloon_split(
\ "Some comment\n\ntypedef this that;"))
endfunc
func Test_popup_position()
if !CanRunVimInTerminal()
return
endif
let lines =<< trim END
123456789_123456789_123456789_a
123456789_123456789_123456789_b
123
END
call writefile(lines, 'Xtest')
let buf = RunVimInTerminal('Xtest', {})
call term_sendkeys(buf, ":vsplit\<CR>")
" default pumwidth in left window: overlap in right window
call term_sendkeys(buf, "GA\<C-N>")
call VerifyScreenDump(buf, 'Test_popup_position_01', {'rows': 8})
call term_sendkeys(buf, "\<Esc>u")
" default pumwidth: fill until right of window
call term_sendkeys(buf, "\<C-W>l")
call term_sendkeys(buf, "GA\<C-N>")
call VerifyScreenDump(buf, 'Test_popup_position_02', {'rows': 8})
" larger pumwidth: used as minimum width
call term_sendkeys(buf, "\<Esc>u")
call term_sendkeys(buf, ":set pumwidth=30\<CR>")
call term_sendkeys(buf, "GA\<C-N>")
call VerifyScreenDump(buf, 'Test_popup_position_03', {'rows': 8})
" completed text wider than the window and 'pumwidth' smaller than available
" space
call term_sendkeys(buf, "\<Esc>u")
call term_sendkeys(buf, ":set pumwidth=20\<CR>")
call term_sendkeys(buf, "ggI123456789_\<Esc>")
call term_sendkeys(buf, "jI123456789_\<Esc>")
call term_sendkeys(buf, "GA\<C-N>")
call VerifyScreenDump(buf, 'Test_popup_position_04', {'rows': 10})
call term_sendkeys(buf, "\<Esc>u")
call StopVimInTerminal(buf)
call delete('Xtest')
endfunc
func Test_popup_command()
CheckFeature menu
menu Test.Foo Foo
call assert_fails('popup Test.Foo', 'E336:')
call assert_fails('popup Test.Foo.X', 'E327:')
call assert_fails('popup Foo', 'E337:')
unmenu Test.Foo
endfunc
func Test_popup_command_dump()
CheckFeature menu
CheckScreendump
let script =<< trim END
func StartTimer()
call timer_start(100, {-> ChangeMenu()})
endfunc
func ChangeMenu()
aunmenu PopUp.&Paste
nnoremenu 1.40 PopUp.&Paste :echomsg "pasted"<CR>
echomsg 'changed'
endfunc
END
call writefile(script, 'XtimerScript', 'D')
let lines =<< trim END
one two three four five
and one two Xthree four five
one more two three four five
END
call writefile(lines, 'Xtest', 'D')
let buf = RunVimInTerminal('-S XtimerScript Xtest', {})
call term_sendkeys(buf, ":source $VIMRUNTIME/menu.vim\<CR>")
call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>")
call VerifyScreenDump(buf, 'Test_popup_command_01', {})
" go to the Paste entry in the menu
call term_sendkeys(buf, "jj")
call VerifyScreenDump(buf, 'Test_popup_command_02', {})
" Select a word
call term_sendkeys(buf, "j\<CR>")
call VerifyScreenDump(buf, 'Test_popup_command_03', {})
call term_sendkeys(buf, "\<Esc>")
" Set a timer to change a menu entry while it's displayed. The text should
" not change but the command does. Making the screendump also verifies that
" "changed" shows up, which means the timer triggered.
call term_sendkeys(buf, "/X\<CR>:call StartTimer() | popup PopUp\<CR>")
call VerifyScreenDump(buf, 'Test_popup_command_04', {})
" Select the Paste entry, executes the changed menu item.
call term_sendkeys(buf, "jj\<CR>")
call VerifyScreenDump(buf, 'Test_popup_command_05', {})
call term_sendkeys(buf, "\<Esc>")
" Add a window toolbar to the window and check the :popup menu position.
call term_sendkeys(buf, ":nnoremenu WinBar.TEST :\<CR>")
call term_sendkeys(buf, "/X\<CR>:popup PopUp\<CR>")
call VerifyScreenDump(buf, 'Test_popup_command_06', {})
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
endfunc
func Test_popup_complete_backwards()
new
call setline(1, ['Post', 'Port', 'Po'])
let expected=['Post', 'Port', 'Port']
call cursor(3,2)
call feedkeys("A\<C-X>". repeat("\<C-P>", 3). "rt\<cr>", 'tx')
call assert_equal(expected, getline(1,'$'))
bwipe!
endfunc
func Test_popup_complete_backwards_ctrl_p()
new
call setline(1, ['Post', 'Port', 'Po'])
let expected=['Post', 'Port', 'Port']
call cursor(3,2)
call feedkeys("A\<C-P>\<C-N>rt\<cr>", 'tx')
call assert_equal(expected, getline(1,'$'))
bwipe!
endfunc
func Test_complete_o_tab()
CheckFunction test_override
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
endfunc
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
endfunc
func Test_menu_only_exists_in_terminal()
CheckCommand tlmenu
CheckNotGui
tlnoremenu &Edit.&Paste<Tab>"+gP <C-W>"+
aunmenu *
try
popup Edit
call assert_false(1, 'command should have failed')
catch
call assert_exception('E328:')
endtry
endfunc
" This used to crash before patch 8.1.1424
func Test_popup_delete_when_shown()
CheckFeature menu
CheckNotGui
func Func()
popup Foo
return "\<Ignore>"
endfunc
nmenu Foo.Bar :
nnoremap <expr> <F2> Func()
call feedkeys("\<F2>\<F2>\<Esc>", 'xt')
delfunc Func
nunmenu Foo.Bar
nunmap <F2>
endfunc
func Test_popup_complete_info_01()
new
inoremap <buffer><F5> <C-R>=complete_info().mode<CR>
func s:complTestEval() abort
call complete(1, ['aa', 'ab'])
return ''
endfunc
inoremap <buffer><F6> <C-R>=s:complTestEval()<CR>
call writefile([
\ 'dummy dummy.txt 1',
\], 'Xdummy.txt')
setlocal tags=Xdummy.txt
setlocal dictionary=Xdummy.txt
setlocal thesaurus=Xdummy.txt
setlocal omnifunc=syntaxcomplete#Complete
setlocal completefunc=syntaxcomplete#Complete
setlocal spell
for [keys, mode_name] in [
\ ["", ''],
\ ["\<C-X>", 'ctrl_x'],
\ ["\<C-X>\<C-N>", 'keyword'],
\ ["\<C-X>\<C-P>", 'keyword'],
\ ["\<C-X>\<C-E>", 'scroll'],
\ ["\<C-X>\<C-Y>", 'scroll'],
\ ["\<C-X>\<C-E>\<C-E>\<C-Y>", 'scroll'],
\ ["\<C-X>\<C-Y>\<C-E>\<C-Y>", 'scroll'],
\ ["\<C-X>\<C-L>", 'whole_line'],
\ ["\<C-X>\<C-F>", 'files'],
\ ["\<C-X>\<C-]>", 'tags'],
\ ["\<C-X>\<C-D>", 'path_defines'],
\ ["\<C-X>\<C-I>", 'path_patterns'],
\ ["\<C-X>\<C-K>", 'dictionary'],
\ ["\<C-X>\<C-T>", 'thesaurus'],
\ ["\<C-X>\<C-V>", 'cmdline'],
\ ["\<C-X>\<C-U>", 'function'],
\ ["\<C-X>\<C-O>", 'omni'],
\ ["\<C-X>s", 'spell'],
\ ["\<F6>", 'eval'],
\]
call feedkeys("i" . keys . "\<F5>\<Esc>", 'tx')
call assert_equal(mode_name, getline('.'))
%d
endfor
call delete('Xdummy.txt')
bwipe!
endfunc
func UserDefinedComplete(findstart, base)
if a:findstart
return 0
else
return [
\ { 'word': 'Jan', 'menu': 'January' },
\ { 'word': 'Feb', 'menu': 'February' },
\ { 'word': 'Mar', 'menu': 'March' },
\ { 'word': 'Apr', 'menu': 'April' },
\ { 'word': 'May', 'menu': 'May' },
\ ]
endif
endfunc
func GetCompleteInfo()
if empty(g:compl_what)
let g:compl_info = complete_info()
else
let g:compl_info = g:compl_what->complete_info()
endif
return ''
endfunc
func Test_popup_complete_info_02()
new
inoremap <buffer><F5> <C-R>=GetCompleteInfo()<CR>
setlocal completefunc=UserDefinedComplete
let d = {
\ 'mode': 'function',
\ 'pum_visible': 1,
\ 'items': [
\ {'word': 'Jan', 'menu': 'January', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'Feb', 'menu': 'February', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'Mar', 'menu': 'March', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'Apr', 'menu': 'April', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''},
\ {'word': 'May', 'menu': 'May', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}
\ ],
\ 'selected': 0,
\ }
let g:compl_what = []
call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
call assert_equal(d, g:compl_info)
let g:compl_what = ['mode', 'pum_visible', 'selected']
call remove(d, 'items')
call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
call assert_equal(d, g:compl_info)
let g:compl_what = ['mode']
call remove(d, 'selected')
call remove(d, 'pum_visible')
call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
call assert_equal(d, g:compl_info)
bwipe!
endfunc
func Test_popup_complete_info_no_pum()
new
call assert_false( pumvisible() )
let no_pum_info = complete_info()
let d = {
\ 'mode': '',
\ 'pum_visible': 0,
\ 'items': [],
\ 'selected': -1,
\ }
call assert_equal( d, complete_info() )
bwipe!
endfunc
func Test_CompleteChanged()
new
call setline(1, ['foo', 'bar', 'foobar', ''])
set complete=. completeopt=noinsert,noselect,menuone
function! OnPumChange()
let g:event = copy(v:event)
let g:item = get(v:event, 'completed_item', {})
let g:word = get(g:item, 'word', v:null)
endfunction
augroup AAAAA_Group
au!
autocmd CompleteChanged * :call OnPumChange()
augroup END
call cursor(4, 1)
call feedkeys("Sf\<C-N>", 'tx')
call assert_equal({'completed_item': {}, 'width': 15.0,
\ 'height': 2.0, 'size': 2,
\ 'col': 0.0, 'row': 4.0, 'scrollbar': v:false}, g:event)
call feedkeys("a\<C-N>\<C-N>\<C-E>", 'tx')
call assert_equal('foo', g:word)
call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-E>", 'tx')
call assert_equal('foobar', g:word)
call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-E>", 'tx')
call assert_equal(v:null, g:word)
call feedkeys("a\<C-N>\<C-N>\<C-N>\<C-N>\<C-P>", 'tx')
call assert_equal('foobar', g:word)
autocmd! AAAAA_Group
set complete& completeopt&
delfunc! OnPumChange
bw!
endfunc
func GetPumPosition()
call assert_true( pumvisible() )
let g:pum_pos = pum_getpos()
return ''
endfunc
func Test_pum_getpos()
new
inoremap <buffer><F5> <C-R>=GetPumPosition()<CR>
setlocal completefunc=UserDefinedComplete
let d = {
\ 'height': 5.0,
\ 'width': 15.0,
\ 'row': 1.0,
\ 'col': 0.0,
\ 'size': 5,
\ 'scrollbar': v:false,
\ }
call feedkeys("i\<C-X>\<C-U>\<F5>", 'tx')
call assert_equal(d, g:pum_pos)
call assert_false( pumvisible() )
call assert_equal( {}, pum_getpos() )
bw!
unlet g:pum_pos
endfunc
" Test for the popup menu with the 'rightleft' option set
func Test_pum_rightleft()
CheckFeature rightleft
CheckScreendump
let lines =<< trim END
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
vim
victory
END
call writefile(lines, 'Xtest1')
let buf = RunVimInTerminal('--cmd "set rightleft" Xtest1', {})
call term_wait(buf)
call term_sendkeys(buf, "Go\<C-P>")
call term_wait(buf)
call VerifyScreenDump(buf, 'Test_pum_rightleft_01', {'rows': 8})
call term_sendkeys(buf, "\<C-P>\<C-Y>")
call term_wait(buf)
redraw!
call assert_match('\s*miv', Screenline(5))
" Test for expanding tabs to spaces in the popup menu
let lines =<< trim END
one two
one three
four
END
call writefile(lines, 'Xtest2')
call term_sendkeys(buf, "\<Esc>:e! Xtest2\<CR>")
call term_wait(buf)
call term_sendkeys(buf, "Goone\<C-X>\<C-L>")
call term_wait(buf)
redraw!
call VerifyScreenDump(buf, 'Test_pum_rightleft_02', {'rows': 7})
call term_sendkeys(buf, "\<C-Y>")
call term_wait(buf)
redraw!
call assert_match('\s*eerht eno', Screenline(4))
call StopVimInTerminal(buf)
call delete('Xtest1')
call delete('Xtest2')
endfunc
" Test for a popup menu with a scrollbar
func Test_pum_scrollbar()
CheckScreendump
let lines =<< trim END
one
two
three
END
call writefile(lines, 'Xtest1')
let buf = RunVimInTerminal('--cmd "set pumheight=2" Xtest1', {})
call term_wait(buf)
call term_sendkeys(buf, "Go\<C-P>\<C-P>\<C-P>")
call term_wait(buf)
call VerifyScreenDump(buf, 'Test_pum_scrollbar_01', {'rows': 7})
call term_sendkeys(buf, "\<C-E>\<Esc>dd")
call term_wait(buf)
if has('rightleft')
call term_sendkeys(buf, ":set rightleft\<CR>")
call term_wait(buf)
call term_sendkeys(buf, "Go\<C-P>\<C-P>\<C-P>")
call term_wait(buf)
call VerifyScreenDump(buf, 'Test_pum_scrollbar_02', {'rows': 7})
endif
call StopVimInTerminal(buf)
call delete('Xtest1')
endfunc
" Test default highlight groups for popup menu
func Test_pum_highlights_default()
CheckScreendump
let lines =<< trim END
func CompleteFunc( findstart, base )
if a:findstart
return 0
endif
return {
\ 'words': [
\ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', },
\ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', },
\ { 'word': 'aword3', 'menu': 'extra text 3', 'kind': 'W', },
\]}
endfunc
set completeopt=menu
set completefunc=CompleteFunc
END
call writefile(lines, 'Xscript', 'D')
let buf = RunVimInTerminal('-S Xscript', {})
call TermWait(buf)
call term_sendkeys(buf, "iaw\<C-X>\<C-u>")
call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_01', {})
call term_sendkeys(buf, "\<C-E>\<Esc>u")
call TermWait(buf)
call StopVimInTerminal(buf)
endfunc
" Test custom highlight groups for popup menu
func Test_pum_highlights_custom()
CheckScreendump
let lines =<< trim END
func CompleteFunc( findstart, base )
if a:findstart
return 0
endif
return {
\ 'words': [
\ { 'word': 'aword1', 'menu': 'extra text 1', 'kind': 'W', },
\ { 'word': 'aword2', 'menu': 'extra text 2', 'kind': 'W', },
\ { 'word': 'aword3', 'menu': 'extra text 3', 'kind': 'W', },
\]}
endfunc
set completeopt=menu
set completefunc=CompleteFunc
hi PmenuKind ctermfg=1 ctermbg=225
hi PmenuKindSel ctermfg=1 ctermbg=7
hi PmenuExtra ctermfg=243 ctermbg=225
hi PmenuExtraSel ctermfg=0 ctermbg=7
END
call writefile(lines, 'Xscript', 'D')
let buf = RunVimInTerminal('-S Xscript', {})
call TermWait(buf)
call term_sendkeys(buf, "iaw\<C-X>\<C-u>")
call TermWait(buf, 50)
call VerifyScreenDump(buf, 'Test_pum_highlights_02', {})
call term_sendkeys(buf, "\<C-E>\<Esc>u")
call TermWait(buf)
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab