comparison src/testdir/test_cmdline.vim @ 32609:0da40da0bbaa v9.0.1636

patch 9.0.1636: expanding a pattern interferes with cmdline completion Commit: https://github.com/vim/vim/commit/094dd152fe1d47878ec6c0b3f54b03ffde7f4a2d Author: zeertzjq <zeertzjq@outlook.com> Date: Thu Jun 15 22:51:57 2023 +0100 patch 9.0.1636: expanding a pattern interferes with cmdline completion Problem: Expanding a pattern interferes with command line completion. Solution: Set the file index only when appropriate. (closes https://github.com/vim/vim/issues/12519)
author Bram Moolenaar <Bram@vim.org>
date Fri, 16 Jun 2023 00:00:03 +0200
parents 0a0b9371957f
children 448aef880252
comparison
equal deleted inserted replaced
32608:5782057ea5d4 32609:0da40da0bbaa
1334 1334
1335 call feedkeys(":py3f\<Tab>\<C-B>\"\<CR>", 'xt') 1335 call feedkeys(":py3f\<Tab>\<C-B>\"\<CR>", 'xt')
1336 call assert_equal('"py3file', @:) 1336 call assert_equal('"py3file', @:)
1337 endfunc 1337 endfunc
1338 1338
1339 " Test that expanding a pattern doesn't interfere with cmdline completion.
1340 func Test_expand_during_cmdline_completion()
1341 func ExpandStuff()
1342 badd <script>:p:h/README.*
1343 call assert_equal(expand('<script>:p:h') .. '/README.txt', bufname('$'))
1344 $bwipe
1345 call assert_equal('README.txt', expand('README.*'))
1346 call assert_equal(['README.txt'], getcompletion('README.*', 'file'))
1347 endfunc
1348 augroup test_CmdlineChanged
1349 autocmd!
1350 autocmd CmdlineChanged * call ExpandStuff()
1351 augroup END
1352
1353 call feedkeys(":sign \<Tab>\<Tab>\<Tab>\<Tab>\<C-B>\"\<CR>", 'xt')
1354 call assert_equal('"sign place', @:)
1355
1356 augroup test_CmdlineChanged
1357 au!
1358 augroup END
1359 augroup! test_CmdlineChanged
1360 delfunc ExpandStuff
1361 endfunc
1362
1339 " Test for 'wildignorecase' 1363 " Test for 'wildignorecase'
1340 func Test_cmdline_wildignorecase() 1364 func Test_cmdline_wildignorecase()
1341 CheckUnix 1365 CheckUnix
1342 call writefile([], 'XTEST', 'D') 1366 call writefile([], 'XTEST', 'D')
1343 set wildignorecase 1367 set wildignorecase
1673 call assert_fails('2,3!echo "x"', 'E135:') 1697 call assert_fails('2,3!echo "x"', 'E135:')
1674 1698
1675 augroup test_cmd_filter_E135 1699 augroup test_cmd_filter_E135
1676 au! 1700 au!
1677 augroup END 1701 augroup END
1702 augroup! test_cmd_filter_E135
1678 %bwipe! 1703 %bwipe!
1679 endfunc 1704 endfunc
1680 1705
1681 func Test_cmd_bang_args() 1706 func Test_cmd_bang_args()
1682 new 1707 new
2132 endfunc 2157 endfunc
2133 2158
2134 func Test_cmd_map_cmdlineChanged() 2159 func Test_cmd_map_cmdlineChanged()
2135 let g:log = [] 2160 let g:log = []
2136 cnoremap <F1> l<Cmd><CR>s 2161 cnoremap <F1> l<Cmd><CR>s
2137 augroup test 2162 augroup test_CmdlineChanged
2138 autocmd! 2163 autocmd!
2139 autocmd CmdlineChanged : let g:log += [getcmdline()] 2164 autocmd CmdlineChanged : let g:log += [getcmdline()]
2140 augroup END 2165 augroup END
2141 2166
2142 call feedkeys(":\<F1>\<CR>", 'xt') 2167 call feedkeys(":\<F1>\<CR>", 'xt')
2148 call feedkeys(":\<F1>\<CR>", 'xt') 2173 call feedkeys(":\<F1>\<CR>", 'xt')
2149 call assert_equal(['a', 'ab'], g:log) 2174 call assert_equal(['a', 'ab'], g:log)
2150 2175
2151 unlet g:log 2176 unlet g:log
2152 cunmap <F1> 2177 cunmap <F1>
2153 augroup test 2178 augroup test_CmdlineChanged
2154 autocmd! 2179 autocmd!
2155 augroup END 2180 augroup END
2181 augroup! test_CmdlineChanged
2156 endfunc 2182 endfunc
2157 2183
2158 " Test for the 'suffixes' option 2184 " Test for the 'suffixes' option
2159 func Test_suffixes_opt() 2185 func Test_suffixes_opt()
2160 call writefile([], 'Xsuffile', 'D') 2186 call writefile([], 'Xsuffile', 'D')