Karsten Hopp a4d873
To: vim_dev@googlegroups.com
Karsten Hopp a4d873
Subject: Patch 7.4.602
Karsten Hopp a4d873
Fcc: outbox
Karsten Hopp a4d873
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a4d873
Mime-Version: 1.0
Karsten Hopp a4d873
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a4d873
Content-Transfer-Encoding: 8bit
Karsten Hopp a4d873
------------
Karsten Hopp a4d873
Karsten Hopp a4d873
Patch 7.4.602
Karsten Hopp a4d873
Problem:    ":set" does not accept hex numbers as documented.
Karsten Hopp a4d873
Solution:   Use vim_str2nr(). (ZyX)
Karsten Hopp a4d873
Files:	    src/option.c, runtime/doc/options.txt
Karsten Hopp a4d873
Karsten Hopp a4d873
Karsten Hopp a4d873
*** ../vim-7.4.601/src/option.c	2014-11-30 13:34:16.885626772 +0100
Karsten Hopp a4d873
--- src/option.c	2015-01-27 15:51:01.455344467 +0100
Karsten Hopp a4d873
***************
Karsten Hopp a4d873
*** 4540,4560 ****
Karsten Hopp a4d873
  				goto skip;
Karsten Hopp a4d873
  			    }
Karsten Hopp a4d873
  			}
Karsten Hopp a4d873
- 				/* allow negative numbers (for 'undolevels') */
Karsten Hopp a4d873
  			else if (*arg == '-' || VIM_ISDIGIT(*arg))
Karsten Hopp a4d873
  			{
Karsten Hopp a4d873
! 			    i = 0;
Karsten Hopp a4d873
! 			    if (*arg == '-')
Karsten Hopp a4d873
! 				i = 1;
Karsten Hopp a4d873
! #ifdef HAVE_STRTOL
Karsten Hopp a4d873
! 			    value = strtol((char *)arg, NULL, 0);
Karsten Hopp a4d873
! 			    if (arg[i] == '0' && TOLOWER_ASC(arg[i + 1]) == 'x')
Karsten Hopp a4d873
! 				i += 2;
Karsten Hopp a4d873
! #else
Karsten Hopp a4d873
! 			    value = atol((char *)arg);
Karsten Hopp a4d873
! #endif
Karsten Hopp a4d873
! 			    while (VIM_ISDIGIT(arg[i]))
Karsten Hopp a4d873
! 				++i;
Karsten Hopp a4d873
  			    if (arg[i] != NUL && !vim_iswhite(arg[i]))
Karsten Hopp a4d873
  			    {
Karsten Hopp a4d873
  				errmsg = e_invarg;
Karsten Hopp a4d873
--- 4540,4550 ----
Karsten Hopp a4d873
  				goto skip;
Karsten Hopp a4d873
  			    }
Karsten Hopp a4d873
  			}
Karsten Hopp a4d873
  			else if (*arg == '-' || VIM_ISDIGIT(*arg))
Karsten Hopp a4d873
  			{
Karsten Hopp a4d873
! 			    /* Allow negative (for 'undolevels'), octal and
Karsten Hopp a4d873
! 			     * hex numbers. */
Karsten Hopp a4d873
! 			    vim_str2nr(arg, NULL, &i, TRUE, TRUE, &value, NULL);
Karsten Hopp a4d873
  			    if (arg[i] != NUL && !vim_iswhite(arg[i]))
Karsten Hopp a4d873
  			    {
Karsten Hopp a4d873
  				errmsg = e_invarg;
Karsten Hopp a4d873
*** ../vim-7.4.601/runtime/doc/options.txt	2014-11-05 17:44:47.676471691 +0100
Karsten Hopp a4d873
--- runtime/doc/options.txt	2015-01-27 15:47:53.873380762 +0100
Karsten Hopp a4d873
***************
Karsten Hopp a4d873
*** 59,67 ****
Karsten Hopp a4d873
  :se[t] {option}:{value}
Karsten Hopp a4d873
  			Set string or number option to {value}.
Karsten Hopp a4d873
  			For numeric options the value can be given in decimal,
Karsten Hopp a4d873
! 			hex (preceded with 0x) or octal (preceded with '0')
Karsten Hopp a4d873
! 			(hex and octal are only available for machines which
Karsten Hopp a4d873
! 			have the strtol() function).
Karsten Hopp a4d873
  			The old value can be inserted by typing 'wildchar' (by
Karsten Hopp a4d873
  			default this is a <Tab> or CTRL-E if 'compatible' is
Karsten Hopp a4d873
  			set).  See |cmdline-completion|.
Karsten Hopp a4d873
--- 59,65 ----
Karsten Hopp a4d873
  :se[t] {option}:{value}
Karsten Hopp a4d873
  			Set string or number option to {value}.
Karsten Hopp a4d873
  			For numeric options the value can be given in decimal,
Karsten Hopp a4d873
!  			hex (preceded with 0x) or octal (preceded with '0').
Karsten Hopp a4d873
  			The old value can be inserted by typing 'wildchar' (by
Karsten Hopp a4d873
  			default this is a <Tab> or CTRL-E if 'compatible' is
Karsten Hopp a4d873
  			set).  See |cmdline-completion|.
Karsten Hopp a4d873
*** ../vim-7.4.601/src/version.c	2015-01-27 15:18:55.156333265 +0100
Karsten Hopp a4d873
--- src/version.c	2015-01-27 15:49:28.840349899 +0100
Karsten Hopp a4d873
***************
Karsten Hopp a4d873
*** 743,744 ****
Karsten Hopp a4d873
--- 743,746 ----
Karsten Hopp a4d873
  {   /* Add new patch number below this line */
Karsten Hopp a4d873
+ /**/
Karsten Hopp a4d873
+     602,
Karsten Hopp a4d873
  /**/
Karsten Hopp a4d873
Karsten Hopp a4d873
-- 
Karsten Hopp a4d873
hundred-and-one symptoms of being an internet addict:
Karsten Hopp a4d873
128. You can access the Net -- via your portable and cellular phone.
Karsten Hopp a4d873
Karsten Hopp a4d873
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a4d873
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a4d873
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a4d873
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///