Mirror of the Vim source from https://github.com/vim/vim
リビジョン | 93f90f2ff4e9abccfaed8425bcffccf94edbd8e4 (tree) |
---|---|
日時 | 2021-01-27 06:45:04 |
作者 | Bram Moolenaar <Bram@vim....> |
コミッター | Bram Moolenaar |
patch 8.2.2415: no way to check for the cmdwin feature
Commit: https://github.com/vim/vim/commit/21829c5f2c86cd525c8468121b4fc54c5d75bf6e
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 26 22:42:21 2021 +0100
@@ -1096,7 +1096,7 @@ | ||
1096 | 1096 | In the command-line window the command line can be edited just like editing |
1097 | 1097 | text in any window. It is a special kind of window, because you cannot leave |
1098 | 1098 | it in a normal way. |
1099 | -{not available when compiled without the |+cmdline_hist| feature} | |
1099 | +{not available when compiled without the |+cmdwin| feature} | |
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | OPEN *c_CTRL-F* *q:* *q/* *q?* |
@@ -4651,6 +4651,13 @@ | ||
4651 | 4651 | }, |
4652 | 4652 | {"cmdline_compl", 1}, |
4653 | 4653 | {"cmdline_hist", 1}, |
4654 | + {"cmdwin", | |
4655 | +#ifdef FEAT_CMDWIN | |
4656 | + 1 | |
4657 | +#else | |
4658 | + 0 | |
4659 | +#endif | |
4660 | + }, | |
4654 | 4661 | {"comments", 1}, |
4655 | 4662 | {"conceal", |
4656 | 4663 | #ifdef FEAT_CONCEAL |
@@ -527,6 +527,7 @@ | ||
527 | 527 | " Test for quitting Vim with unedited files in the argument list |
528 | 528 | func Test_quit_with_arglist() |
529 | 529 | CheckRunVimInTerminal |
530 | + | |
530 | 531 | let buf = RunVimInTerminal('', {'rows': 6}) |
531 | 532 | call term_sendkeys(buf, ":set nomore\n") |
532 | 533 | call term_sendkeys(buf, ":args a b c\n") |
@@ -561,9 +562,13 @@ | ||
561 | 562 | |
562 | 563 | " Test for ":all" not working when in the cmdline window |
563 | 564 | func Test_all_not_allowed_from_cmdwin() |
565 | + CheckFeature cmdwin | |
566 | + " TODO: why does this hang on Windows? | |
567 | + CheckNotMSWindows | |
568 | + | |
564 | 569 | au BufEnter * all |
565 | 570 | next x |
566 | - call assert_fails(":norm 7q?x\<CR>", 'E11:') | |
571 | + call assert_fails(":norm 7q?print\<CR>", 'E11:') | |
567 | 572 | au! BufEnter |
568 | 573 | endfunc |
569 | 574 |
@@ -2397,10 +2397,8 @@ | ||
2397 | 2397 | |
2398 | 2398 | func Test_autocmd_CmdWinEnter() |
2399 | 2399 | CheckRunVimInTerminal |
2400 | - " There is not cmdwin switch, so | |
2401 | - " test for cmdline_hist | |
2402 | - " (both are available with small builds) | |
2403 | - CheckFeature cmdline_hist | |
2400 | + CheckFeature cmdwin | |
2401 | + | |
2404 | 2402 | let lines =<< trim END |
2405 | 2403 | let b:dummy_var = 'This is a dummy' |
2406 | 2404 | autocmd CmdWinEnter * quit |
@@ -129,7 +129,6 @@ | ||
129 | 129 | endfunc |
130 | 130 | |
131 | 131 | func Test_map_completion() |
132 | - CheckFeature cmdline_compl | |
133 | 132 | call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt') |
134 | 133 | call assert_equal('"map <unique> <silent>', getreg(':')) |
135 | 134 | call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt') |
@@ -207,7 +206,6 @@ | ||
207 | 206 | endfunc |
208 | 207 | |
209 | 208 | func Test_match_completion() |
210 | - CheckFeature cmdline_compl | |
211 | 209 | hi Aardig ctermfg=green |
212 | 210 | call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt') |
213 | 211 | call assert_equal('"match Aardig', getreg(':')) |
@@ -216,7 +214,6 @@ | ||
216 | 214 | endfunc |
217 | 215 | |
218 | 216 | func Test_highlight_completion() |
219 | - CheckFeature cmdline_compl | |
220 | 217 | hi Aardig ctermfg=green |
221 | 218 | call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt') |
222 | 219 | call assert_equal('"hi Aardig', getreg(':')) |
@@ -253,7 +250,6 @@ | ||
253 | 250 | endfunc |
254 | 251 | |
255 | 252 | func Test_getcompletion() |
256 | - CheckFeature cmdline_compl | |
257 | 253 | let groupcount = len(getcompletion('', 'event')) |
258 | 254 | call assert_true(groupcount > 0) |
259 | 255 | let matchcount = len('File'->getcompletion('event')) |
@@ -980,6 +976,8 @@ | ||
980 | 976 | endfunc |
981 | 977 | |
982 | 978 | func Test_getcmdwintype() |
979 | + CheckFeature cmdwin | |
980 | + | |
983 | 981 | call feedkeys("q/:let a = getcmdwintype()\<CR>:q\<CR>", 'x!') |
984 | 982 | call assert_equal('/', a) |
985 | 983 |
@@ -996,6 +994,8 @@ | ||
996 | 994 | endfunc |
997 | 995 | |
998 | 996 | func Test_getcmdwin_autocmd() |
997 | + CheckFeature cmdwin | |
998 | + | |
999 | 999 | let s:seq = [] |
1000 | 1000 | augroup CmdWin |
1001 | 1001 | au WinEnter * call add(s:seq, 'WinEnter ' .. win_getid()) |
@@ -1108,6 +1108,8 @@ | ||
1108 | 1108 | endfunc |
1109 | 1109 | |
1110 | 1110 | func Test_cmdwin_bug() |
1111 | + CheckFeature cmdwin | |
1112 | + | |
1111 | 1113 | let winid = win_getid() |
1112 | 1114 | sp |
1113 | 1115 | try |
@@ -1118,6 +1120,7 @@ | ||
1118 | 1120 | endfunc |
1119 | 1121 | |
1120 | 1122 | func Test_cmdwin_restore() |
1123 | + CheckFeature cmdwin | |
1121 | 1124 | CheckScreendump |
1122 | 1125 | |
1123 | 1126 | let lines =<< trim [SCRIPT] |
@@ -1193,6 +1196,8 @@ | ||
1193 | 1196 | endfunc |
1194 | 1197 | |
1195 | 1198 | func Test_cmdwin_feedkeys() |
1199 | + CheckFeature cmdwin | |
1200 | + | |
1196 | 1201 | " This should not generate E488 |
1197 | 1202 | call feedkeys("q:\<CR>", 'x') |
1198 | 1203 | " Using feedkeys with q: only should automatically close the cmd window |
@@ -1204,6 +1209,8 @@ | ||
1204 | 1209 | " Tests for the issues fixed in 7.4.441. |
1205 | 1210 | " When 'cedit' is set to Ctrl-C, opening the command window hangs Vim |
1206 | 1211 | func Test_cmdwin_cedit() |
1212 | + CheckFeature cmdwin | |
1213 | + | |
1207 | 1214 | exe "set cedit=\<C-c>" |
1208 | 1215 | normal! : |
1209 | 1216 | call assert_equal(1, winnr('$')) |
@@ -1226,6 +1233,8 @@ | ||
1226 | 1233 | |
1227 | 1234 | " Test for CmdwinEnter autocmd |
1228 | 1235 | func Test_cmdwin_autocmd() |
1236 | + CheckFeature cmdwin | |
1237 | + | |
1229 | 1238 | augroup CmdWin |
1230 | 1239 | au! |
1231 | 1240 | autocmd CmdwinEnter * startinsert |
@@ -1268,6 +1277,8 @@ | ||
1268 | 1277 | endfunc |
1269 | 1278 | |
1270 | 1279 | func Test_cmdwin_jump_to_win() |
1280 | + CheckFeature cmdwin | |
1281 | + | |
1271 | 1282 | call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:') |
1272 | 1283 | new |
1273 | 1284 | set modified |
@@ -1284,6 +1295,7 @@ | ||
1284 | 1295 | endfunc |
1285 | 1296 | |
1286 | 1297 | func Test_cmdwin_interrupted() |
1298 | + CheckFeature cmdwin | |
1287 | 1299 | CheckScreendump |
1288 | 1300 | |
1289 | 1301 | " aborting the :smile output caused the cmdline window to use the current |
@@ -1570,6 +1582,8 @@ | ||
1570 | 1582 | |
1571 | 1583 | " Test for recursively getting multiple command line inputs |
1572 | 1584 | func Test_cmdwin_multi_input() |
1585 | + CheckFeature cmdwin | |
1586 | + | |
1573 | 1587 | call feedkeys(":\<C-R>=input('P: ')\<CR>\"cyan\<CR>\<CR>", 'xt') |
1574 | 1588 | call assert_equal('"cyan', @:) |
1575 | 1589 | endfunc |
@@ -1594,6 +1608,8 @@ | ||
1594 | 1608 | |
1595 | 1609 | " Test for normal mode commands not supported in the cmd window |
1596 | 1610 | func Test_cmdwin_blocked_commands() |
1611 | + CheckFeature cmdwin | |
1612 | + | |
1597 | 1613 | call assert_fails('call feedkeys("q:\<C-T>\<CR>", "xt")', 'E11:') |
1598 | 1614 | call assert_fails('call feedkeys("q:\<C-]>\<CR>", "xt")', 'E11:') |
1599 | 1615 | call assert_fails('call feedkeys("q:\<C-^>\<CR>", "xt")', 'E11:') |
@@ -1625,6 +1641,8 @@ | ||
1625 | 1641 | |
1626 | 1642 | " Close the Cmd-line window in insert mode using CTRL-C |
1627 | 1643 | func Test_cmdwin_insert_mode_close() |
1644 | + CheckFeature cmdwin | |
1645 | + | |
1628 | 1646 | %bw! |
1629 | 1647 | let s = '' |
1630 | 1648 | exe "normal q:a\<C-C>let s='Hello'\<CR>" |
@@ -343,6 +343,8 @@ | ||
343 | 343 | endfunc |
344 | 344 | |
345 | 345 | func Test_compl_in_cmdwin() |
346 | + CheckFeature cmdwin | |
347 | + | |
346 | 348 | set wildmenu wildchar=<Tab> |
347 | 349 | com! -nargs=1 -complete=command GetInput let input = <q-args> |
348 | 350 | com! -buffer TestCommand echo 'TestCommand' |
@@ -2584,9 +2584,11 @@ | ||
2584 | 2584 | call assert_false(&insertmode) |
2585 | 2585 | call assert_beeps("normal! \<C-\>\<C-A>", 'xt') |
2586 | 2586 | |
2587 | - " Using CTRL-\ CTRL-N in cmd window should close the window | |
2588 | - call feedkeys("q:\<C-\>\<C-N>", 'xt') | |
2589 | - call assert_equal('', getcmdwintype()) | |
2587 | + if has('cmdwin') | |
2588 | + " Using CTRL-\ CTRL-N in cmd window should close the window | |
2589 | + call feedkeys("q:\<C-\>\<C-N>", 'xt') | |
2590 | + call assert_equal('', getcmdwintype()) | |
2591 | + endif | |
2590 | 2592 | |
2591 | 2593 | " clean up |
2592 | 2594 | bw! |
@@ -617,6 +617,8 @@ | ||
617 | 617 | |
618 | 618 | " Test for closing the tab page from a command window |
619 | 619 | func Test_tabpage_close_cmdwin() |
620 | + CheckFeature cmdwin | |
621 | + | |
620 | 622 | tabnew |
621 | 623 | call feedkeys("q/:tabclose\<CR>\<Esc>", 'xt') |
622 | 624 | call assert_equal(2, tabpagenr('$')) |
@@ -367,6 +367,8 @@ | ||
367 | 367 | |
368 | 368 | " Test for using the mouse to increaes the height of the cmdline window |
369 | 369 | func Test_mouse_cmdwin_resize() |
370 | + CheckFeature cmdwin | |
371 | + | |
370 | 372 | let save_mouse = &mouse |
371 | 373 | let save_term = &term |
372 | 374 | let save_ttymouse = &ttymouse |
@@ -19,6 +19,8 @@ | ||
19 | 19 | endfunc |
20 | 20 | |
21 | 21 | func Test_window_cmd_cmdwin_with_vsp() |
22 | + CheckFeature cmdwin | |
23 | + | |
22 | 24 | let efmt = 'Expected 0 but got %d (in ls=%d, %s window)' |
23 | 25 | for v in range(0, 2) |
24 | 26 | exec "set ls=" . v |
@@ -751,6 +751,8 @@ | ||
751 | 751 | static int included_patches[] = |
752 | 752 | { /* Add new patch number below this line */ |
753 | 753 | /**/ |
754 | + 2415, | |
755 | +/**/ | |
754 | 756 | 2414, |
755 | 757 | /**/ |
756 | 758 | 2413, |