forked from aniani/vim
patch 8.2.2533: Vim9: cannot use a range with :unlet
Problem: Vim9: cannot use a range with :unlet. Solution: Implement ISN_UNLETRANGE.
This commit is contained in:
20
src/list.c
20
src/list.c
@@ -530,6 +530,26 @@ list_find_str(list_T *l, long idx)
|
||||
return tv_get_string(&li->li_tv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Like list_find() but when a negative index is used that is not found use
|
||||
* zero and set "idx" to zero. Used for first index of a range.
|
||||
*/
|
||||
listitem_T *
|
||||
list_find_index(list_T *l, long *idx)
|
||||
{
|
||||
listitem_T *li = list_find(l, *idx);
|
||||
|
||||
if (li == NULL)
|
||||
{
|
||||
if (*idx < 0)
|
||||
{
|
||||
*idx = 0;
|
||||
li = list_find(l, *idx);
|
||||
}
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
/*
|
||||
* Locate "item" list "l" and return its index.
|
||||
* Returns -1 when "item" is not in the list.
|
||||
|
||||
Reference in New Issue
Block a user