0
0
mirror of https://github.com/vim/vim.git synced 2025-10-09 06:14:17 -04:00

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)
This commit is contained in:
Bram Moolenaar
2015-11-10 17:50:24 +01:00
parent 98b30a473a
commit 174674743d
4 changed files with 13 additions and 3 deletions

View File

@@ -4883,9 +4883,10 @@ do_set(arg, opt_flags)
{ {
i = (int)STRLEN(origval); i = (int)STRLEN(origval);
/* strip a trailing comma, would get 2 */ /* strip a trailing comma, would get 2 */
if (comma && (flags & P_ONECOMMA) && i > 1 if (comma && i > 1
&& origval[i - 1] == ',' && (flags & P_ONECOMMA) == P_ONECOMMA
&& origval[i - 2] != '\\') && origval[i - 1] == ','
&& origval[i - 2] != '\\')
i--; i--;
mch_memmove(newval + i + comma, newval, mch_memmove(newval + i + comma, newval,
STRLEN(newval) + 1); STRLEN(newval) + 1);

View File

@@ -10,6 +10,12 @@ STARTTEST
:endtry :endtry
:buf 1 :buf 1
:$put =caught :$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 :/^result/,$w! test.out
:qa! :qa!
ENDTEST ENDTEST

View File

@@ -1,2 +1,3 @@
result result
ok ok
foo,,bar

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
915,
/**/ /**/
914, 914,
/**/ /**/