Skip to content

Commit 1746747

Browse files
committed
patch 7.4.915
Problem: When removing from 'path' and then adding, a comma may go missing. (Malcolm Rowe) Solution: Fix the check for P_ONECOMMA. (closes #471)
1 parent 98b30a4 commit 1746747

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/option.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4883,9 +4883,10 @@ do_set(arg, opt_flags)
48834883
{
48844884
i = (int)STRLEN(origval);
48854885
/* strip a trailing comma, would get 2 */
4886-
if (comma && (flags & P_ONECOMMA) && i > 1
4887-
&& origval[i - 1] == ','
4888-
&& origval[i - 2] != '\\')
4886+
if (comma && i > 1
4887+
&& (flags & P_ONECOMMA) == P_ONECOMMA
4888+
&& origval[i - 1] == ','
4889+
&& origval[i - 2] != '\\')
48894890
i--;
48904891
mch_memmove(newval + i + comma, newval,
48914892
STRLEN(newval) + 1);

src/testdir/test_options.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ STARTTEST
1010
:endtry
1111
:buf 1
1212
:$put =caught
13+
:"
14+
:" Test that changing 'path' keeps two commas.
15+
:set path=foo,,bar
16+
:set path-=bar
17+
:set path+=bar
18+
:$put =&path
1319
:/^result/,$w! test.out
1420
:qa!
1521
ENDTEST

src/testdir/test_options.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
result
22
ok
3+
foo,,bar

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
915,
744746
/**/
745747
914,
746748
/**/

0 commit comments

Comments
 (0)