To: vim_dev@googlegroups.com Subject: Patch 7.3.828 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.828 Problem: Mappings are not aware of wildmenu mode. Solution: Add wildmenumode(). (Christian Brabandt) Files: src/eval.c, runtime/doc/eval.txt *** ../vim-7.3.827/src/eval.c 2013-02-20 15:19:38.000000000 +0100 --- src/eval.c 2013-02-20 17:45:19.000000000 +0100 *************** *** 751,756 **** --- 751,757 ---- static void f_values __ARGS((typval_T *argvars, typval_T *rettv)); static void f_virtcol __ARGS((typval_T *argvars, typval_T *rettv)); static void f_visualmode __ARGS((typval_T *argvars, typval_T *rettv)); + static void f_wildmenumode __ARGS((typval_T *argvars, typval_T *rettv)); static void f_winbufnr __ARGS((typval_T *argvars, typval_T *rettv)); static void f_wincol __ARGS((typval_T *argvars, typval_T *rettv)); static void f_winheight __ARGS((typval_T *argvars, typval_T *rettv)); *************** *** 8121,8126 **** --- 8122,8128 ---- {"values", 1, 1, f_values}, {"virtcol", 1, 1, f_virtcol}, {"visualmode", 0, 1, f_visualmode}, + {"wildmenumode", 0, 0, f_wildmenumode}, {"winbufnr", 1, 1, f_winbufnr}, {"wincol", 0, 0, f_wincol}, {"winheight", 1, 1, f_winheight}, *************** *** 18576,18581 **** --- 18578,18597 ---- #endif } + /* + * "wildmenumode()" function + */ + static void + f_wildmenumode(argvars, rettv) + typval_T *argvars UNUSED; + typval_T *rettv UNUSED; + { + #ifdef FEAT_WILDMENU + if (wild_menu_showing) + rettv->vval.v_number = 1; + #endif + } + /* * "winbufnr(nr)" function */ *** ../vim-7.3.827/runtime/doc/eval.txt 2013-02-13 17:34:59.000000000 +0100 --- runtime/doc/eval.txt 2013-02-20 17:43:23.000000000 +0100 *************** *** 1974,1986 **** toupper( {expr}) String the String {expr} switched to uppercase tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} to chars in {tostr} ! trunc( {expr} Float truncate Float {expr} type( {name}) Number type of variable {name} undofile( {name}) String undo file name for {name} undotree() List undo file tree values( {dict}) List values in {dict} virtcol( {expr}) Number screen column of cursor or mark visualmode( [expr]) String last visual mode used winbufnr( {nr}) Number buffer number of window {nr} wincol() Number window column of the cursor winheight( {nr}) Number height of window {nr} --- 1986,1999 ---- toupper( {expr}) String the String {expr} switched to uppercase tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr} to chars in {tostr} ! trunc( {expr}) Float truncate Float {expr} type( {name}) Number type of variable {name} undofile( {name}) String undo file name for {name} undotree() List undo file tree values( {dict}) List values in {dict} virtcol( {expr}) Number screen column of cursor or mark visualmode( [expr]) String last visual mode used + wildmenumode() Number whether 'wildmenu' mode is active winbufnr( {nr}) Number buffer number of window {nr} wincol() Number window column of the cursor winheight( {nr}) Number height of window {nr} *************** *** 6121,6126 **** --- 6163,6180 ---- Dictionary or Float is not a Number or String, thus does not cause the mode to be cleared. + wildmenumode() *wildmenumode()* + Returns non-zero when the wildmenu is active and zero + otherwise. See 'wildmenu' and 'wildmode'. + This can be used in mappings to handle the 'wildcharm' option + gracefully. (Makes only sense with |mapmode-c| mappings). + + For example to make work like in wildmode, use: > + :cnoremap wildmenumode() ? "\\" : "\" + < + (Note, this needs the 'wildcharm' option set appropriately). + + *winbufnr()* winbufnr({nr}) The result is a Number, which is the number of the buffer associated with window {nr}. When {nr} is zero, the number of *** ../vim-7.3.827/src/version.c 2013-02-20 16:54:24.000000000 +0100 --- src/version.c 2013-02-20 17:41:17.000000000 +0100 *************** *** 730,731 **** --- 730,733 ---- { /* Add new patch number below this line */ + /**/ + 828, /**/ -- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///