mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch: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) https://code.google.com/p/vim/source/detail?r=v7-4-419
This commit is contained in:
parent
e450c541dd
commit
96be11f609
@ -2241,6 +2241,22 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, ch
|
||||
: lp->ll_tv->vval.v_dict->dv_lock, lp->ll_name))
|
||||
;
|
||||
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 (listitem_T *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.
|
||||
*/
|
||||
@ -2804,6 +2820,17 @@ static int do_unlet_var(lval_T *lp, char_u *name_end, int forceit)
|
||||
return FAIL;
|
||||
else if (lp->ll_range) {
|
||||
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 false;
|
||||
}
|
||||
ll_li = li;
|
||||
ll_n1++;
|
||||
}
|
||||
|
||||
/* Delete a range of List items. */
|
||||
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
|
||||
: 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
|
||||
:set rtp+=./sautest
|
||||
:lockvar g:footest#x
|
||||
|
@ -86,6 +86,11 @@ FFFFFFF
|
||||
FFpFFpp
|
||||
0000-000
|
||||
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
|
||||
exists g:footest#x:0
|
||||
g:footest#x: 1
|
||||
|
@ -246,7 +246,7 @@ static int included_patches[] = {
|
||||
//422,
|
||||
//421,
|
||||
//420 NA
|
||||
//419,
|
||||
419,
|
||||
418,
|
||||
//417,
|
||||
//416,
|
||||
|
Loading…
Reference in New Issue
Block a user