Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.4.915
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

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)
Files:      src/option.c, src/testdir/test_options.in, 
            src/testdir/test_options.ok


*** ../vim-7.4.914/src/option.c	2015-11-10 13:30:34.999047749 +0100
--- src/option.c	2015-11-10 17:46:36.191651303 +0100
***************
*** 4883,4891 ****
  				{
  				    i = (int)STRLEN(origval);
  				    /* strip a trailing comma, would get 2 */
! 				    if (comma && (flags & P_ONECOMMA) && i > 1
! 					            && origval[i - 1] == ','
! 						    && origval[i - 2] != '\\')
  					i--;
  				    mch_memmove(newval + i + comma, newval,
  							  STRLEN(newval) + 1);
--- 4883,4892 ----
  				{
  				    i = (int)STRLEN(origval);
  				    /* strip a trailing comma, would get 2 */
! 				    if (comma && i > 1
! 					  && (flags & P_ONECOMMA) == P_ONECOMMA
! 					  && origval[i - 1] == ','
! 					  && origval[i - 2] != '\\')
  					i--;
  				    mch_memmove(newval + i + comma, newval,
  							  STRLEN(newval) + 1);
*** ../vim-7.4.914/src/testdir/test_options.in	2014-04-01 14:08:14.685074130 +0200
--- src/testdir/test_options.in	2015-11-10 17:45:50.096107003 +0100
***************
*** 10,15 ****
--- 10,21 ----
  :endtry
  :buf 1
  :$put =caught
+ :"
+ :" Test that changing 'path' keeps two commas.
+ :set path=foo,,bar
+ :set path-=bar
+ :set path+=bar
+ :$put =&path
  :/^result/,$w! test.out
  :qa!
  ENDTEST
*** ../vim-7.4.914/src/testdir/test_options.ok	2014-04-01 14:08:14.685074130 +0200
--- src/testdir/test_options.ok	2015-11-10 17:46:07.283937094 +0100
***************
*** 1,2 ****
--- 1,3 ----
  result
  ok
+ foo,,bar
*** ../vim-7.4.914/src/version.c	2015-11-10 15:17:59.166278487 +0100
--- src/version.c	2015-11-10 17:48:31.650509518 +0100
***************
*** 743,744 ****
--- 743,746 ----
  {   /* Add new patch number below this line */
+ /**/
+     915,
  /**/

-- 
There's no place like $(HOME)!

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///