aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 8ba10fd38a..74250e83e6 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1749,7 +1749,7 @@ do_set (
if (flags & P_FLAGLIST) {
// Remove flags that appear twice.
- for (s = newval; *s; s++) {
+ for (s = newval; *s;) {
// if options have P_FLAGLIST and P_ONECOMMA such as
// 'whichwrap'
if (flags & P_ONECOMMA) {
@@ -1757,15 +1757,16 @@ do_set (
&& vim_strchr(s + 2, *s) != NULL) {
// Remove the duplicated value and the next comma.
STRMOVE(s, s + 2);
- s -= 2;
+ continue;
}
} else {
if ((!(flags & P_COMMA) || *s != ',')
&& vim_strchr(s + 1, *s) != NULL) {
STRMOVE(s, s + 1);
- s--;
+ continue;
}
}
+ s++;
}
}