> So, what do you suggest? Do an "or" of the lock flag for all the items
> in the slice?
I see three possibilities:
1. Check locks in the same cycle listitem_remove is called (so items that are
not locked will be removed).
2. Add cycle just before it which will check locks before removal (so items
will be removed only if all items are not locked).
3. Do not check locks at all (happens for `:unlet var`, but not for `:unlet
g:['var']`).
First and third are the easiest ones (I briefly checked only second one!):
First:
diff -r 18fd959b07ef src/eval.c
--- a/src/eval.c Ср авг 13 22:05:54 2014 +0200
+++ b/src/eval.c Вс авг 17 21:19:53 2014 +0400
@@ -3651,7 +3651,8 @@ do_unlet_var(lp, name_end, forceit)
while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1))
{
li = lp->ll_li->li_next;
- listitem_remove(lp->ll_list, lp->ll_li);
+ if (!tv_check_lock(li->li_tv.v_lock, lp->ll_name))
+ listitem_remove(lp->ll_list, lp->ll_li);
lp->ll_li = li;
++lp->ll_n1;
}
Second:
diff -r 18fd959b07ef src/eval.c
--- a/src/eval.c Ср авг 13 22:05:54 2014 +0200
+++ b/src/eval.c Вс авг 17 21:25:13 2014 +0400
@@ -3646,6 +3646,17 @@ do_unlet_var(lp, name_end, forceit)
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(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))
Third:
diff -r 18fd959b07ef src/eval.c
--- a/src/eval.c Ср авг 13 22:05:54 2014 +0200
+++ b/src/eval.c Вс авг 17 21:17:53 2014 +0400
@@ -3641,8 +3641,6 @@ do_unlet_var(lp, name_end, forceit)
ret = FAIL;
*name_end = cc;
}
- else if (tv_check_lock(lp->ll_tv->v_lock, lp->ll_name))
- return FAIL;
else if (lp->ll_range)
{
listitem_T *li;
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.