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