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)
diff --git a/src/eval.c b/src/eval.c
index 654e418..a8e9463 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2945,6 +2945,23 @@
;
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.
*/
@@ -3646,6 +3663,17 @@
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 FAIL;
+ 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))
diff --git a/src/testdir/test55.in b/src/testdir/test55.in
index 8e073f3..140cb7c 100644
--- a/src/testdir/test55.in
+++ b/src/testdir/test55.in
Binary files differ
diff --git a/src/testdir/test55.ok b/src/testdir/test55.ok
index dfd8060..e8560de 100644
--- a/src/testdir/test55.ok
+++ b/src/testdir/test55.ok
@@ -86,6 +86,11 @@
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
diff --git a/src/version.c b/src/version.c
index b2c3289..d2ea613 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 419,
+/**/
418,
/**/
417,