diff options
-rw-r--r-- | src/nvim/option.c | 7 | ||||
-rw-r--r-- | src/nvim/testdir/test_options.vim | 6 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
3 files changed, 11 insertions, 4 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++; } } diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 5ee0919e18..2ffe63787b 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -13,6 +13,12 @@ function! Test_whichwrap() set whichwrap+=h,l call assert_equal('b,s,h,l', &whichwrap) + set whichwrap=h,h + call assert_equal('h', &whichwrap) + + set whichwrap=h,h,h + call assert_equal('h', &whichwrap) + set whichwrap& endfunction diff --git a/src/nvim/version.c b/src/nvim/version.c index 6f38776a60..f5df256d3d 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -647,7 +647,7 @@ static const int included_patches[] = { 308, 307, // 306, - // 305, + 305, // 304, // 303, // 302, |