424e24c
To: vim-dev@vim.org
424e24c
Subject: Patch 7.0.039
424e24c
Fcc: outbox
424e24c
From: Bram Moolenaar <Bram@moolenaar.net>
424e24c
Mime-Version: 1.0
424e24c
Content-Type: text/plain; charset=ISO-8859-1
424e24c
Content-Transfer-Encoding: 8bit
424e24c
------------
424e24c
424e24c
Patch 7.0.039
424e24c
Problem:    Calling inputdialog() with a third argument in the console doesn't
424e24c
            work.
424e24c
Solution:   Make a separate function for input() and inputdialog(). (Yegappan
424e24c
            Lakshmanan)
424e24c
Files:      src/eval.c
424e24c
424e24c
424e24c
*** ../vim-7.0.038/src/eval.c	Wed Jul 12 21:48:56 2006
424e24c
--- src/eval.c	Mon Jul 10 23:03:13 2006
424e24c
***************
424e24c
*** 11321,11334 ****
424e24c
  
424e24c
  static int inputsecret_flag = 0;
424e24c
  
424e24c
  /*
424e24c
!  * "input()" function
424e24c
!  *     Also handles inputsecret() when inputsecret is set.
424e24c
   */
424e24c
      static void
424e24c
! f_input(argvars, rettv)
424e24c
      typval_T	*argvars;
424e24c
      typval_T	*rettv;
424e24c
  {
424e24c
      char_u	*prompt = get_tv_string_chk(&argvars[0]);
424e24c
      char_u	*p = NULL;
424e24c
--- 11321,11339 ----
424e24c
  
424e24c
  static int inputsecret_flag = 0;
424e24c
  
424e24c
+ static void get_user_input __ARGS((typval_T *argvars, typval_T *rettv, int inputdialog));
424e24c
+ 
424e24c
  /*
424e24c
!  * This function is used by f_input() and f_inputdialog() functions. The third
424e24c
!  * argument to f_input() specifies the type of completion to use at the
424e24c
!  * prompt. The third argument to f_inputdialog() specifies the value to return
424e24c
!  * when the user cancels the prompt.
424e24c
   */
424e24c
      static void
424e24c
! get_user_input(argvars, rettv, inputdialog)
424e24c
      typval_T	*argvars;
424e24c
      typval_T	*rettv;
424e24c
+     int		inputdialog;
424e24c
  {
424e24c
      char_u	*prompt = get_tv_string_chk(&argvars[0]);
424e24c
      char_u	*p = NULL;
424e24c
***************
424e24c
*** 11378,11384 ****
424e24c
  	    if (defstr != NULL)
424e24c
  		stuffReadbuffSpec(defstr);
424e24c
  
424e24c
! 	    if (argvars[2].v_type != VAR_UNKNOWN)
424e24c
  	    {
424e24c
  		char_u	*xp_name;
424e24c
  		int	xp_namelen;
424e24c
--- 11383,11389 ----
424e24c
  	    if (defstr != NULL)
424e24c
  		stuffReadbuffSpec(defstr);
424e24c
  
424e24c
! 	    if (!inputdialog && argvars[2].v_type != VAR_UNKNOWN)
424e24c
  	    {
424e24c
  		char_u	*xp_name;
424e24c
  		int	xp_namelen;
424e24c
***************
424e24c
*** 11413,11418 ****
424e24c
--- 11418,11435 ----
424e24c
  }
424e24c
  
424e24c
  /*
424e24c
+  * "input()" function
424e24c
+  *     Also handles inputsecret() when inputsecret is set.
424e24c
+  */
424e24c
+     static void
424e24c
+ f_input(argvars, rettv)
424e24c
+     typval_T	*argvars;
424e24c
+     typval_T	*rettv;
424e24c
+ {
424e24c
+     get_user_input(argvars, rettv, FALSE);
424e24c
+ }
424e24c
+ 
424e24c
+ /*
424e24c
   * "inputdialog()" function
424e24c
   */
424e24c
      static void
424e24c
***************
424e24c
*** 11452,11458 ****
424e24c
      }
424e24c
      else
424e24c
  #endif
424e24c
! 	f_input(argvars, rettv);
424e24c
  }
424e24c
  
424e24c
  /*
424e24c
--- 11469,11475 ----
424e24c
      }
424e24c
      else
424e24c
  #endif
424e24c
! 	get_user_input(argvars, rettv, TRUE);
424e24c
  }
424e24c
  
424e24c
  /*
424e24c
*** ../vim-7.0.038/src/version.c	Wed Jul 12 21:48:56 2006
424e24c
--- src/version.c	Wed Jul 12 21:56:30 2006
424e24c
***************
424e24c
*** 668,669 ****
424e24c
--- 668,671 ----
424e24c
  {   /* Add new patch number below this line */
424e24c
+ /**/
424e24c
+     39,
424e24c
  /**/
424e24c
424e24c
-- 
424e24c
A consultant is a person who takes your money and annoys your employees while
424e24c
tirelessly searching for the best way to extend the consulting contract.
424e24c
				(Scott Adams - The Dilbert principle)
424e24c
424e24c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
424e24c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
424e24c
\\\        download, build and distribute -- http://www.A-A-P.org        ///
424e24c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///