e713213
To: vim-dev@vim.org
e713213
Subject: patch 7.1.012
e713213
Fcc: outbox
e713213
From: Bram Moolenaar <Bram@moolenaar.net>
e713213
Mime-Version: 1.0
e713213
Content-Type: text/plain; charset=ISO-8859-1
e713213
Content-Transfer-Encoding: 8bit
e713213
------------
e713213
e713213
Patch 7.1.012
e713213
Problem:    ":let &shiftwidth = 'asdf'" doesn't produce an error message.
e713213
Solution:   Check for a string argument. (Chris Lubinski)
e713213
Files:	    src/option.c
e713213
e713213
e713213
*** ../vim-7.1.011/src/option.c	Sun May  6 15:37:32 2007
e713213
--- src/option.c	Tue Jun 19 20:56:36 2007
e713213
***************
e713213
*** 8219,8224 ****
e713213
--- 8219,8243 ----
e713213
  	    varp = get_varp(&options[opt_idx]);
e713213
  	    if (varp != NULL)	/* hidden option is not changed */
e713213
  	    {
e713213
+ 		if (number == 0 && string != NULL)
e713213
+ 		{
e713213
+ 		    int index;
e713213
+ 
e713213
+ 		    /* Either we are given a string or we are setting option
e713213
+ 		     * to zero. */
e713213
+ 		    for (index = 0; string[index] == '0'; ++index)
e713213
+ 			;
e713213
+ 		    if (string[index] != NUL || index == 0)
e713213
+ 		    {
e713213
+ 			/* There's another character after zeros or the string
e713213
+ 			 * is empty.  In both cases, we are trying to set a
e713213
+ 			 * num option using a string. */
e713213
+ 			EMSG3(_("E521: Number required: &%s = '%s'"),
e713213
+ 								name, string);
e713213
+ 			return;     /* do nothing as we hit an error */
e713213
+ 
e713213
+ 		    }
e713213
+ 		}
e713213
  		if (flags & P_NUM)
e713213
  		    (void)set_num_option(opt_idx, varp, number,
e713213
  							  NULL, 0, opt_flags);
e713213
*** ../vim-7.1.011/src/version.c	Tue Jun 19 20:30:46 2007
e713213
--- src/version.c	Tue Jun 19 20:53:15 2007
e713213
***************
e713213
*** 668,669 ****
e713213
--- 668,671 ----
e713213
  {   /* Add new patch number below this line */
e713213
+ /**/
e713213
+     12,
e713213
  /**/
e713213
e713213
-- 
e713213
Ten million Linux users can't be wrong!
e713213
e713213
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
e713213
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
e713213
\\\        download, build and distribute -- http://www.A-A-P.org        ///
e713213
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///