comparison src/option.c @ 9798:e34e4547f3d1 v7.4.2174

commit https://github.com/vim/vim/commit/c8ce615299b4d8c1b2e6cf83496f48cd497d8a37 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 7 13:48:20 2016 +0200 patch 7.4.2174 Problem: Adding duplicate flags to 'whichwrap' leaves commas behind. Solution: Also remove the commas. (Naruhiko Nishino)
author Christian Brabandt <cb@256bit.org>
date Sun, 07 Aug 2016 14:00:06 +0200
parents fd9727ae3c49
children 4eea48b76d03
comparison
equal deleted inserted replaced
9797:ab17b539c1ba 9798:e34e4547f3d1
4917 4917
4918 if (flags & P_FLAGLIST) 4918 if (flags & P_FLAGLIST)
4919 { 4919 {
4920 /* Remove flags that appear twice. */ 4920 /* Remove flags that appear twice. */
4921 for (s = newval; *s; ++s) 4921 for (s = newval; *s; ++s)
4922 if ((!(flags & P_COMMA) || *s != ',') 4922 {
4923 && vim_strchr(s + 1, *s) != NULL) 4923 /* if options have P_FLAGLIST and
4924 * P_ONECOMMA such as 'whichwrap' */
4925 if (flags & P_ONECOMMA)
4924 { 4926 {
4925 STRMOVE(s, s + 1); 4927 if (*s != ',' && *(s + 1) == ','
4926 --s; 4928 && vim_strchr(s + 2, *s) != NULL)
4929 {
4930 /* Remove the duplicated value and
4931 * the next comma. */
4932 STRMOVE(s, s + 2);
4933 s -= 2;
4934 }
4927 } 4935 }
4936 else
4937 {
4938 if ((!(flags & P_COMMA) || *s != ',')
4939 && vim_strchr(s + 1, *s) != NULL)
4940 {
4941 STRMOVE(s, s + 1);
4942 --s;
4943 }
4944 }
4945 }
4928 } 4946 }
4929 4947
4930 if (save_arg != NULL) /* number for 'whichwrap' */ 4948 if (save_arg != NULL) /* number for 'whichwrap' */
4931 arg = save_arg; 4949 arg = save_arg;
4932 new_value_alloced = TRUE; 4950 new_value_alloced = TRUE;