]> granicus.if.org Git - vim/commitdiff
patch 8.2.2415: no way to check for the cmdwin feature v8.2.2415
authorBram Moolenaar <Bram@vim.org>
Tue, 26 Jan 2021 21:42:21 +0000 (22:42 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 26 Jan 2021 21:42:21 +0000 (22:42 +0100)
Problem:    No way to check for the cmdwin feature, cmdline_hist is now always
            enabled.
Solution:   Add has('cmdwin') support. Skip arglist test on Windows
            temporarily.

runtime/doc/cmdline.txt
src/evalfunc.c
src/testdir/test_arglist.vim
src/testdir/test_autocmd.vim
src/testdir/test_cmdline.vim
src/testdir/test_ins_complete.vim
src/testdir/test_normal.vim
src/testdir/test_tabpage.vim
src/testdir/test_termcodes.vim
src/testdir/test_window_cmd.vim
src/version.c

index 990380f04764e2a40d2a931406b800535160ad55..efb1400f1918e1871cdd023a801ce6e1eb1895df 100644 (file)
@@ -1096,7 +1096,7 @@ Also see |`=|.
 In the command-line window the command line can be edited just like editing
 text in any window.  It is a special kind of window, because you cannot leave
 it in a normal way.
-{not available when compiled without the |+cmdline_hist| feature}
+{not available when compiled without the |+cmdwin| feature}
 
 
 OPEN                                           *c_CTRL-F* *q:* *q/* *q?*
index cc812ce33662d0bc887fad91d8e18a8f5a08346d..b752c51d10d2d2c56ebf74f12df9474faed3af17 100644 (file)
@@ -4651,6 +4651,13 @@ f_has(typval_T *argvars, typval_T *rettv)
                },
        {"cmdline_compl", 1},
        {"cmdline_hist", 1},
+       {"cmdwin",
+#ifdef FEAT_CMDWIN
+               1
+#else
+               0
+#endif
+               },
        {"comments", 1},
        {"conceal",
 #ifdef FEAT_CONCEAL
index b72fe2d5349acda600c17f870590fae6a6c8e016..62029934900510c78acf65cb6c4ac8e28783a5b5 100644 (file)
@@ -527,6 +527,7 @@ endfunc
 " Test for quitting Vim with unedited files in the argument list
 func Test_quit_with_arglist()
   CheckRunVimInTerminal
+
   let buf = RunVimInTerminal('', {'rows': 6})
   call term_sendkeys(buf, ":set nomore\n")
   call term_sendkeys(buf, ":args a b c\n")
@@ -561,9 +562,13 @@ endfunc
 
 " Test for ":all" not working when in the cmdline window
 func Test_all_not_allowed_from_cmdwin()
+  CheckFeature cmdwin
+  " TODO: why does this hang on Windows?
+  CheckNotMSWindows
+
   au BufEnter * all
   next x
-  call assert_fails(":norm 7q?x\<CR>", 'E11:')
+  call assert_fails(":norm 7q?print\<CR>", 'E11:')
   au! BufEnter
 endfunc
 
index 5ec854e67640a87c603936c25d67c883a3d3cfc7..60369c2479fbddebe80ac3d10db41bb959f63772 100644 (file)
@@ -2397,10 +2397,8 @@ endfunc
 
 func Test_autocmd_CmdWinEnter()
   CheckRunVimInTerminal
-  " There is not cmdwin switch, so
-  " test for cmdline_hist
-  " (both are available with small builds)
-  CheckFeature cmdline_hist
+  CheckFeature cmdwin
+
   let lines =<< trim END
     let b:dummy_var = 'This is a dummy'
     autocmd CmdWinEnter * quit
index cb16de12469c903b698437c7dc3fb0fbb6e3ff8e..c2bbcc6c0f00589d01efa0e6a296f8ef8ebbdc64 100644 (file)
@@ -129,7 +129,6 @@ func Test_wildmenu_screendump()
 endfunc
 
 func Test_map_completion()
-  CheckFeature cmdline_compl
   call feedkeys(":map <unique> <si\<Tab>\<Home>\"\<CR>", 'xt')
   call assert_equal('"map <unique> <silent>', getreg(':'))
   call feedkeys(":map <script> <un\<Tab>\<Home>\"\<CR>", 'xt')
@@ -207,7 +206,6 @@ func Test_map_completion()
 endfunc
 
 func Test_match_completion()
-  CheckFeature cmdline_compl
   hi Aardig ctermfg=green
   call feedkeys(":match \<Tab>\<Home>\"\<CR>", 'xt')
   call assert_equal('"match Aardig', getreg(':'))
@@ -216,7 +214,6 @@ func Test_match_completion()
 endfunc
 
 func Test_highlight_completion()
-  CheckFeature cmdline_compl
   hi Aardig ctermfg=green
   call feedkeys(":hi \<Tab>\<Home>\"\<CR>", 'xt')
   call assert_equal('"hi Aardig', getreg(':'))
@@ -253,7 +250,6 @@ func Test_highlight_easter_egg()
 endfunc
 
 func Test_getcompletion()
-  CheckFeature cmdline_compl
   let groupcount = len(getcompletion('', 'event'))
   call assert_true(groupcount > 0)
   let matchcount = len('File'->getcompletion('event'))
@@ -980,6 +976,8 @@ func Test_getcmdtype()
 endfunc
 
 func Test_getcmdwintype()
+  CheckFeature cmdwin
+
   call feedkeys("q/:let a = getcmdwintype()\<CR>:q\<CR>", 'x!')
   call assert_equal('/', a)
 
@@ -996,6 +994,8 @@ func Test_getcmdwintype()
 endfunc
 
 func Test_getcmdwin_autocmd()
+  CheckFeature cmdwin
+
   let s:seq = []
   augroup CmdWin
   au WinEnter * call add(s:seq, 'WinEnter ' .. win_getid())
@@ -1108,6 +1108,8 @@ func Test_cmdline_overstrike()
 endfunc
 
 func Test_cmdwin_bug()
+  CheckFeature cmdwin
+
   let winid = win_getid()
   sp
   try
@@ -1118,6 +1120,7 @@ func Test_cmdwin_bug()
 endfunc
 
 func Test_cmdwin_restore()
+  CheckFeature cmdwin
   CheckScreendump
 
   let lines =<< trim [SCRIPT]
@@ -1193,6 +1196,8 @@ func Test_buffers_lastused()
 endfunc
 
 func Test_cmdwin_feedkeys()
+  CheckFeature cmdwin
+
   " This should not generate E488
   call feedkeys("q:\<CR>", 'x')
   " Using feedkeys with q: only should automatically close the cmd window
@@ -1204,6 +1209,8 @@ endfunc
 " Tests for the issues fixed in 7.4.441.
 " When 'cedit' is set to Ctrl-C, opening the command window hangs Vim
 func Test_cmdwin_cedit()
+  CheckFeature cmdwin
+
   exe "set cedit=\<C-c>"
   normal! :
   call assert_equal(1, winnr('$'))
@@ -1226,6 +1233,8 @@ endfunc
 
 " Test for CmdwinEnter autocmd
 func Test_cmdwin_autocmd()
+  CheckFeature cmdwin
+
   augroup CmdWin
     au!
     autocmd CmdwinEnter * startinsert
@@ -1268,6 +1277,8 @@ func Test_cmdline_expand_special()
 endfunc
 
 func Test_cmdwin_jump_to_win()
+  CheckFeature cmdwin
+
   call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:')
   new
   set modified
@@ -1284,6 +1295,7 @@ func Test_cmdwin_jump_to_win()
 endfunc
 
 func Test_cmdwin_interrupted()
+  CheckFeature cmdwin
   CheckScreendump
 
   " aborting the :smile output caused the cmdline window to use the current
@@ -1570,6 +1582,8 @@ endfunc
 
 " Test for recursively getting multiple command line inputs
 func Test_cmdwin_multi_input()
+  CheckFeature cmdwin
+
   call feedkeys(":\<C-R>=input('P: ')\<CR>\"cyan\<CR>\<CR>", 'xt')
   call assert_equal('"cyan', @:)
 endfunc
@@ -1594,6 +1608,8 @@ endfunc
 
 " Test for normal mode commands not supported in the cmd window
 func Test_cmdwin_blocked_commands()
+  CheckFeature cmdwin
+
   call assert_fails('call feedkeys("q:\<C-T>\<CR>", "xt")', 'E11:')
   call assert_fails('call feedkeys("q:\<C-]>\<CR>", "xt")', 'E11:')
   call assert_fails('call feedkeys("q:\<C-^>\<CR>", "xt")', 'E11:')
@@ -1625,6 +1641,8 @@ endfunc
 
 " Close the Cmd-line window in insert mode using CTRL-C
 func Test_cmdwin_insert_mode_close()
+  CheckFeature cmdwin
+
   %bw!
   let s = ''
   exe "normal q:a\<C-C>let s='Hello'\<CR>"
index b1a2a9e307ec54b34e79c5c97bf7b2c9c8af74f1..e59bd207e5b9d43254f6299cd1fadd6a9411ac5a 100644 (file)
@@ -343,6 +343,8 @@ func Test_compl_feedkeys()
 endfunc
 
 func Test_compl_in_cmdwin()
+  CheckFeature cmdwin
+
   set wildmenu wildchar=<Tab>
   com! -nargs=1 -complete=command GetInput let input = <q-args>
   com! -buffer TestCommand echo 'TestCommand'
index d2f1fab5732040494c87150be21371b603a2799b..8aef41ddda2c3c29f404e3e6fa5149e72d1e201d 100644 (file)
@@ -2584,9 +2584,11 @@ func Test_normal40_ctrl_bsl()
   call assert_false(&insertmode)
   call assert_beeps("normal! \<C-\>\<C-A>", 'xt')
 
-  " Using CTRL-\ CTRL-N in cmd window should close the window
-  call feedkeys("q:\<C-\>\<C-N>", 'xt')
-  call assert_equal('', getcmdwintype())
+  if has('cmdwin')
+    " Using CTRL-\ CTRL-N in cmd window should close the window
+    call feedkeys("q:\<C-\>\<C-N>", 'xt')
+    call assert_equal('', getcmdwintype())
+  endif
 
   " clean up
   bw!
index 38a6283eb0bf2869ee74e109e08538ebb13f2988..dac6d809a89430591194a2953e329b2ac2ea36e9 100644 (file)
@@ -617,6 +617,8 @@ endfunc
 
 " Test for closing the tab page from a command window
 func Test_tabpage_close_cmdwin()
+  CheckFeature cmdwin
+
   tabnew
   call feedkeys("q/:tabclose\<CR>\<Esc>", 'xt')
   call assert_equal(2, tabpagenr('$'))
index 055ed8b65ec24b3427d2bcd8f8e412977363db6c..040869cc0bd9b352dde4e1235649daa67fae514c 100644 (file)
@@ -367,6 +367,8 @@ endfunc
 
 " Test for using the mouse to increaes the height of the cmdline window
 func Test_mouse_cmdwin_resize()
+  CheckFeature cmdwin
+
   let save_mouse = &mouse
   let save_term = &term
   let save_ttymouse = &ttymouse
index 8a97488497ba0ac2a91967176d51e412ed557e11..f26b4474611bf87a1c01480ca1a545d5a2546223 100644 (file)
@@ -19,6 +19,8 @@ func Test_window_cmd_ls0_with_split()
 endfunc
 
 func Test_window_cmd_cmdwin_with_vsp()
+  CheckFeature cmdwin
+
   let efmt = 'Expected 0 but got %d (in ls=%d, %s window)'
   for v in range(0, 2)
     exec "set ls=" . v
index 071a36e8613b95ede0297e9a0013e98dc6011b6d..24a1d7fd44f97aa1689dd50803f3b670d6baca22 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2415,
 /**/
     2414,
 /**/