Patch 8.1.0479
Problem: Failure when setting 'varsofttabstop' to end in a comma. (Ralf
Schandl)
Solution: Reject value with trailing command. Add test for invalid values
(closes #3544)
Files: src/testdir/test_vartabs.vim, src/option.c
*** ../vim-8.1.0478/src/testdir/test_vartabs.vim 2018-06-28
22:22:56.233315600 +0200
--- src/testdir/test_vartabs.vim 2018-10-15 22:50:55.841034425 +0200
***************
*** 5,15 ****
endif
source view_util.vim
! function! s:compare_lines(expect, actual)
call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
! endfunction
! func! Test_vartabs()
new
%d
--- 5,15 ----
endif
source view_util.vim
! func s:compare_lines(expect, actual)
call assert_equal(join(a:expect, "\n"), join(a:actual, "\n"))
! endfunc
! func Test_vartabs()
new
%d
***************
*** 261,267 ****
bwipeout!
endfunc
! func! Test_vartabs_linebreak()
if winwidth(0) < 40
return
endif
--- 261,267 ----
bwipeout!
endfunc
! func Test_vartabs_linebreak()
if winwidth(0) < 40
return
endif
***************
*** 296,298 ****
--- 296,309 ----
bw!
set nolist listchars&vim
endfunc
+
+ func Test_vartabs_failures()
+ call assert_fails('set vts=8,')
+ call assert_fails('set vsts=8,')
+ call assert_fails('set vts=8,,8')
+ call assert_fails('set vsts=8,,8')
+ call assert_fails('set vts=8,,8,')
+ call assert_fails('set vsts=8,,8,')
+ call assert_fails('set vts=,8')
+ call assert_fails('set vsts=,8')
+ endfunc
*** ../vim-8.1.0478/src/option.c 2018-10-02 14:45:07.023652468 +0200
--- src/option.c 2018-10-15 22:49:58.049552333 +0200
***************
*** 12786,12802 ****
int t;
char_u *cp;
! if ((!var[0] || (var[0] == '0' && !var[1])))
{
*array = NULL;
return TRUE;
}
! for (cp = var; *cp; ++cp)
{
! if (cp == var || *(cp - 1) == ',')
{
char_u *end;
if (strtol((char *)cp, (char **)&end, 10) <= 0)
{
if (cp != end)
--- 12786,12803 ----
int t;
char_u *cp;
! if (var[0] == NUL || (var[0] == '0' && var[1] == NUL))
{
*array = NULL;
return TRUE;
}
! for (cp = var; *cp != NUL; ++cp)
{
! if (cp == var || cp[-1] == ',')
{
char_u *end;
+
if (strtol((char *)cp, (char **)&end, 10) <= 0)
{
if (cp != end)
***************
*** 12809,12815 ****
if (VIM_ISDIGIT(*cp))
continue;
! if (*cp == ',' && cp > var && *(cp - 1) != ',')
{
++valcount;
continue;
--- 12810,12816 ----
if (VIM_ISDIGIT(*cp))
continue;
! if (cp[0] == ',' && cp > var && cp[-1] != ',' && cp[1] != NUL)
{
++valcount;
continue;
***************
*** 12818,12833 ****
return FALSE;
}
! *array = (int *) alloc((unsigned) ((valcount + 1) * sizeof(int)));
(*array)[0] = valcount;
t = 1;
! for (cp = var; *cp;)
{
(*array)[t++] = atoi((char *)cp);
! while (*cp && *cp != ',')
++cp;
! if (*cp)
++cp;
}
--- 12819,12834 ----
return FALSE;
}
! *array = (int *)alloc((unsigned) ((valcount + 1) * sizeof(int)));
(*array)[0] = valcount;
t = 1;
! for (cp = var; *cp != NUL;)
{
(*array)[t++] = atoi((char *)cp);
! while (*cp != NUL && *cp != ',')
++cp;
! if (*cp != NUL)
++cp;
}
*** ../vim-8.1.0478/src/version.c 2018-10-15 20:11:14.472652214 +0200
--- src/version.c 2018-10-15 22:51:35.136682428 +0200
***************
*** 794,795 ****
--- 794,797 ----
{ /* Add new patch number below this line */
+ /**/
+ 479,
/**/
--
hundred-and-one symptoms of being an internet addict:
214. Your MCI "Circle of Friends" are all Hayes-compatible.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.