Blame SOURCES/7.4.419

d6ba96
To: vim_dev@googlegroups.com
d6ba96
Subject: Patch 7.4.419
d6ba96
Fcc: outbox
d6ba96
From: Bram Moolenaar <Bram@moolenaar.net>
d6ba96
Mime-Version: 1.0
d6ba96
Content-Type: text/plain; charset=UTF-8
d6ba96
Content-Transfer-Encoding: 8bit
d6ba96
------------
d6ba96
d6ba96
Patch 7.4.419
d6ba96
Problem:    When part of a list is locked it's possible to make changes.
d6ba96
Solution:   Check if any of the list items is locked before make a change.
d6ba96
	    (ZyX)
d6ba96
Files:	    src/eval.c, src/testdir/test55.in, src/testdir/test55.ok
d6ba96
d6ba96
d6ba96
*** ../vim-7.4.418/src/eval.c	2014-08-22 13:13:24.219895762 +0200
d6ba96
--- src/eval.c	2014-08-29 09:37:56.930403905 +0200
d6ba96
***************
d6ba96
*** 2945,2950 ****
d6ba96
--- 2945,2967 ----
d6ba96
  	;
d6ba96
      else if (lp->ll_range)
d6ba96
      {
d6ba96
+ 	listitem_T *ll_li = lp->ll_li;
d6ba96
+ 	int ll_n1 = lp->ll_n1;
d6ba96
+ 
d6ba96
+ 	/*
d6ba96
+ 	 * Check whether any of the list items is locked
d6ba96
+ 	 */
d6ba96
+ 	for (ri = rettv->vval.v_list->lv_first; ri != NULL; )
d6ba96
+ 	{
d6ba96
+ 	    if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name))
d6ba96
+ 		return;
d6ba96
+ 	    ri = ri->li_next;
d6ba96
+ 	    if (ri == NULL || (!lp->ll_empty2 && lp->ll_n2 == ll_n1))
d6ba96
+ 		break;
d6ba96
+ 	    ll_li = ll_li->li_next;
d6ba96
+ 	    ++ll_n1;
d6ba96
+ 	}
d6ba96
+ 
d6ba96
  	/*
d6ba96
  	 * Assign the List values to the list items.
d6ba96
  	 */
d6ba96
***************
d6ba96
*** 3646,3651 ****
d6ba96
--- 3663,3679 ----
d6ba96
      else if (lp->ll_range)
d6ba96
      {
d6ba96
  	listitem_T    *li;
d6ba96
+ 	listitem_T    *ll_li = lp->ll_li;
d6ba96
+ 	int           ll_n1 = lp->ll_n1;
d6ba96
+ 
d6ba96
+ 	while (ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= ll_n1))
d6ba96
+ 	{
d6ba96
+ 	    li = ll_li->li_next;
d6ba96
+ 	    if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name))
d6ba96
+ 		return FAIL;
d6ba96
+ 	    ll_li = li;
d6ba96
+ 	    ++ll_n1;
d6ba96
+ 	}
d6ba96
  
d6ba96
  	/* Delete a range of List items. */
d6ba96
  	while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1))
d6ba96
*** ../vim-7.4.418/src/testdir/test55.in	2014-07-02 19:06:14.686326091 +0200
d6ba96
--- src/testdir/test55.in	2014-08-29 09:37:23.474403832 +0200
d6ba96
***************
d6ba96
*** 282,287 ****
d6ba96
--- 282,302 ----
d6ba96
  :    $put =ps
d6ba96
  :  endfor
d6ba96
  :endfor
d6ba96
+ :unlet l
d6ba96
+ :let l = [1, 2, 3, 4]
d6ba96
+ :lockvar! l
d6ba96
+ :$put =string(l)
d6ba96
+ :unlockvar l[1]
d6ba96
+ :unlet l[0:1]
d6ba96
+ :$put =string(l)
d6ba96
+ :unlet l[1:2]
d6ba96
+ :$put =string(l)
d6ba96
+ :unlockvar l[1]
d6ba96
+ :let l[0:1] = [0, 1]
d6ba96
+ :$put =string(l)
d6ba96
+ :let l[1:2] = [0, 1]
d6ba96
+ :$put =string(l)
d6ba96
+ :unlet l
d6ba96
  :" :lockvar/islocked() triggering script autoloading
d6ba96
  :set rtp+=./sautest
d6ba96
  :lockvar g:footest#x
d6ba96
*** ../vim-7.4.418/src/testdir/test55.ok	2014-07-02 19:06:14.686326091 +0200
d6ba96
--- src/testdir/test55.ok	2014-08-29 09:37:29.606403846 +0200
d6ba96
***************
d6ba96
*** 86,91 ****
d6ba96
--- 86,96 ----
d6ba96
  FFpFFpp
d6ba96
  0000-000
d6ba96
  ppppppp
d6ba96
+ [1, 2, 3, 4]
d6ba96
+ [1, 2, 3, 4]
d6ba96
+ [1, 2, 3, 4]
d6ba96
+ [1, 2, 3, 4]
d6ba96
+ [1, 2, 3, 4]
d6ba96
  locked g:footest#x:-1
d6ba96
  exists g:footest#x:0
d6ba96
  g:footest#x: 1
d6ba96
*** ../vim-7.4.418/src/version.c	2014-08-29 09:02:23.890399246 +0200
d6ba96
--- src/version.c	2014-08-29 09:39:24.658404097 +0200
d6ba96
***************
d6ba96
*** 743,744 ****
d6ba96
--- 743,746 ----
d6ba96
  {   /* Add new patch number below this line */
d6ba96
+ /**/
d6ba96
+     419,
d6ba96
  /**/
d6ba96
d6ba96
-- 
d6ba96
hundred-and-one symptoms of being an internet addict:
d6ba96
90. Instead of calling you to dinner, your spouse sends e-mail.
d6ba96
d6ba96
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
d6ba96
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
d6ba96
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
d6ba96
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///