patch 7.4.741
Problem: When using += with ":set" a trailing comma is not recognized.
(Issue 365)
Solution: Don't add a second comma. Add a test. (partly by Christian
Brabandt)
diff --git a/src/option.c b/src/option.c
index 7bcb26a..a6ce0ac 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4829,6 +4829,10 @@
if (adding)
{
i = (int)STRLEN(origval);
+ /* strip a trailing comma, would get 2 */
+ if (comma && i > 1 && origval[i - 1] == ','
+ && origval[i - 2] != '\\')
+ i--;
mch_memmove(newval + i + comma, newval,
STRLEN(newval) + 1);
mch_memmove(newval, origval, (size_t)i);