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