From c90c47072fbc282c3c6a69d945e9ad7079862a0a Mon Sep 17 00:00:00 2001 From: watiko Date: Tue, 9 Feb 2016 11:51:00 +0900 Subject: vim-patch:7.4.749 Problem: For some options two consecutive commas are OK. (Nikolay Pavlov) Solution: Add the P_ONECOMMA flag. https://github.com/vim/vim/commit/0e7c4b99c608d22fd1b8526e700420b248319b1f --- src/nvim/option.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'src/nvim/option.c') diff --git a/src/nvim/option.c b/src/nvim/option.c index d3a2ce971d..38ce155b24 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -218,20 +218,22 @@ typedef struct vimoption { #define P_RALL 0x6000U /* redraw all windows */ #define P_RCLR 0x7000U /* clear and redraw all */ -#define P_COMMA 0x8000U /* comma separated list */ -#define P_NODUP 0x10000U /* don't allow duplicate strings */ -#define P_FLAGLIST 0x20000U /* list of single-char flags */ - -#define P_SECURE 0x40000U /* cannot change in modeline or secure mode */ -#define P_GETTEXT 0x80000U /* expand default value with _() */ -#define P_NOGLOB 0x100000U /* do not use local value for global vimrc */ -#define P_NFNAME 0x200000U /* only normal file name chars allowed */ -#define P_INSECURE 0x400000U /* option was set from a modeline */ -#define P_PRI_MKRC 0x800000U /* priority for :mkvimrc (setting option has - side effects) */ -#define P_NO_ML 0x1000000U /* not allowed in modeline */ -#define P_CURSWANT 0x2000000U /* update curswant required; not needed when - * there is a redraw flag */ +#define P_COMMA 0x8000U ///< comma separated list +#define P_ONECOMMA 0x18000U ///< P_COMMA and cannot have two consecutive + ///< commas +#define P_NODUP 0x20000U ///< don't allow duplicate strings +#define P_FLAGLIST 0x40000U ///< list of single-char flags + +#define P_SECURE 0x80000U ///< cannot change in modeline or secure mode +#define P_GETTEXT 0x100000U ///< expand default value with _() +#define P_NOGLOB 0x200000U ///< do not use local value for global vimrc +#define P_NFNAME 0x400000U ///< only normal file name chars allowed +#define P_INSECURE 0x800000U ///< option was set from a modeline +#define P_PRI_MKRC 0x1000000U ///< priority for :mkvimrc (setting option + ///< has side effects) +#define P_NO_ML 0x2000000U ///< not allowed in modeline +#define P_CURSWANT 0x4000000U ///< update curswant required; not needed + ///< when there is a redraw flag #define HIGHLIGHT_INIT \ "8:SpecialKey,~:EndOfBuffer,z:TermCursor,Z:TermCursorNC,@:NonText," \ @@ -1674,9 +1676,10 @@ do_set ( if (adding) { i = (int)STRLEN(origval); // Strip a trailing comma, would get 2. - if (comma && i > 1 && origval[i - 1] == ',' + if (comma && (flags & P_ONECOMMA) && i > 1 + && origval[i - 1] == ',' && origval[i - 2] != '\\') { - --i; + i--; } memmove(newval + i + comma, newval, STRLEN(newval) + 1); -- cgit From 69e5427be170d98a413edb1e191254f84d8642f6 Mon Sep 17 00:00:00 2001 From: watiko Date: Tue, 9 Feb 2016 14:10:55 +0900 Subject: vim-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) https://github.com/vim/vim/commit/174674743d9a2d7361c9cd89836f8dd8651edeeb --- src/nvim/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/option.c') diff --git a/src/nvim/option.c b/src/nvim/option.c index 38ce155b24..c11e22703e 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1676,7 +1676,8 @@ do_set ( if (adding) { i = (int)STRLEN(origval); // Strip a trailing comma, would get 2. - if (comma && (flags & P_ONECOMMA) && i > 1 + if (comma && i > 1 + && (flags & P_ONECOMMA) == P_ONECOMMA && origval[i - 1] == ',' && origval[i - 2] != '\\') { i--; -- cgit