From 174674743d9a2d7361c9cd89836f8dd8651edeeb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 10 Nov 2015 17:50:24 +0100 Subject: [PATCH] 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) --- src/option.c | 7 ++++--- src/testdir/test_options.in | 6 ++++++ src/testdir/test_options.ok | 1 + src/version.c | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/option.c b/src/option.c index db3a197af4..bc44cb2d4b 100644 --- a/src/option.c +++ b/src/option.c @@ -4883,9 +4883,10 @@ do_set(arg, opt_flags) { i = (int)STRLEN(origval); /* strip a trailing comma, would get 2 */ - if (comma && (flags & P_ONECOMMA) && i > 1 - && origval[i - 1] == ',' - && origval[i - 2] != '\\') + if (comma && i > 1 + && (flags & P_ONECOMMA) == P_ONECOMMA + && origval[i - 1] == ',' + && origval[i - 2] != '\\') i--; mch_memmove(newval + i + comma, newval, STRLEN(newval) + 1); diff --git a/src/testdir/test_options.in b/src/testdir/test_options.in index bf1232a223..6e56fa2427 100644 --- a/src/testdir/test_options.in +++ b/src/testdir/test_options.in @@ -10,6 +10,12 @@ STARTTEST :endtry :buf 1 :$put =caught +:" +:" Test that changing 'path' keeps two commas. +:set path=foo,,bar +:set path-=bar +:set path+=bar +:$put =&path :/^result/,$w! test.out :qa! ENDTEST diff --git a/src/testdir/test_options.ok b/src/testdir/test_options.ok index a2e1494a1f..07731526bc 100644 --- a/src/testdir/test_options.ok +++ b/src/testdir/test_options.ok @@ -1,2 +1,3 @@ result ok +foo,,bar diff --git a/src/version.c b/src/version.c index 450892a5c5..4fb004d72e 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 915, /**/ 914, /**/ -- 2.47.3