1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0479
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
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 -- Bram@Moolenaar.net -- 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 ///
|