Blame SOURCES/7.4.419

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