mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
updated for version 7.4.419
Problem: Whan part of a list is locked it's possible to make changes. Solution: Check if any of the list items is locked before make a change. (ZyX)
This commit is contained in:
parent
26f08b06b6
commit
f2d912e8bc
28
src/eval.c
28
src/eval.c
@ -2945,6 +2945,23 @@ set_var_lval(lp, endp, rettv, copy, op)
|
|||||||
;
|
;
|
||||||
else if (lp->ll_range)
|
else if (lp->ll_range)
|
||||||
{
|
{
|
||||||
|
listitem_T *ll_li = lp->ll_li;
|
||||||
|
int ll_n1 = lp->ll_n1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether any of the list items is locked
|
||||||
|
*/
|
||||||
|
for (ri = rettv->vval.v_list->lv_first; ri != NULL; )
|
||||||
|
{
|
||||||
|
if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name))
|
||||||
|
return;
|
||||||
|
ri = ri->li_next;
|
||||||
|
if (ri == NULL || (!lp->ll_empty2 && lp->ll_n2 == ll_n1))
|
||||||
|
break;
|
||||||
|
ll_li = ll_li->li_next;
|
||||||
|
++ll_n1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assign the List values to the list items.
|
* Assign the List values to the list items.
|
||||||
*/
|
*/
|
||||||
@ -3646,6 +3663,17 @@ do_unlet_var(lp, name_end, forceit)
|
|||||||
else if (lp->ll_range)
|
else if (lp->ll_range)
|
||||||
{
|
{
|
||||||
listitem_T *li;
|
listitem_T *li;
|
||||||
|
listitem_T *ll_li = lp->ll_li;
|
||||||
|
int ll_n1 = lp->ll_n1;
|
||||||
|
|
||||||
|
while (ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= ll_n1))
|
||||||
|
{
|
||||||
|
li = ll_li->li_next;
|
||||||
|
if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name))
|
||||||
|
return FAIL;
|
||||||
|
ll_li = li;
|
||||||
|
++ll_n1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Delete a range of List items. */
|
/* Delete a range of List items. */
|
||||||
while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1))
|
while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1))
|
||||||
|
@ -282,6 +282,21 @@ let l = [0, 1, 2, 3]
|
|||||||
: $put =ps
|
: $put =ps
|
||||||
: endfor
|
: endfor
|
||||||
:endfor
|
:endfor
|
||||||
|
:unlet l
|
||||||
|
:let l = [1, 2, 3, 4]
|
||||||
|
:lockvar! l
|
||||||
|
:$put =string(l)
|
||||||
|
:unlockvar l[1]
|
||||||
|
:unlet l[0:1]
|
||||||
|
:$put =string(l)
|
||||||
|
:unlet l[1:2]
|
||||||
|
:$put =string(l)
|
||||||
|
:unlockvar l[1]
|
||||||
|
:let l[0:1] = [0, 1]
|
||||||
|
:$put =string(l)
|
||||||
|
:let l[1:2] = [0, 1]
|
||||||
|
:$put =string(l)
|
||||||
|
:unlet l
|
||||||
:" :lockvar/islocked() triggering script autoloading
|
:" :lockvar/islocked() triggering script autoloading
|
||||||
:set rtp+=./sautest
|
:set rtp+=./sautest
|
||||||
:lockvar g:footest#x
|
:lockvar g:footest#x
|
||||||
|
@ -86,6 +86,11 @@ FFFFFFF
|
|||||||
FFpFFpp
|
FFpFFpp
|
||||||
0000-000
|
0000-000
|
||||||
ppppppp
|
ppppppp
|
||||||
|
[1, 2, 3, 4]
|
||||||
|
[1, 2, 3, 4]
|
||||||
|
[1, 2, 3, 4]
|
||||||
|
[1, 2, 3, 4]
|
||||||
|
[1, 2, 3, 4]
|
||||||
locked g:footest#x:-1
|
locked g:footest#x:-1
|
||||||
exists g:footest#x:0
|
exists g:footest#x:0
|
||||||
g:footest#x: 1
|
g:footest#x: 1
|
||||||
|
@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
419,
|
||||||
/**/
|
/**/
|
||||||
418,
|
418,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user