comparison src/list.c @ 23982:9fcd71d0db89 v8.2.2533

patch 8.2.2533: Vim9: cannot use a range with :unlet Commit: https://github.com/vim/vim/commit/5b5ae29bd3d7b832b6f15320430f7f191e0abd1f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 20 17:04:02 2021 +0100 patch 8.2.2533: Vim9: cannot use a range with :unlet Problem: Vim9: cannot use a range with :unlet. Solution: Implement ISN_UNLETRANGE.
author Bram Moolenaar <Bram@vim.org>
date Sat, 20 Feb 2021 17:15:03 +0100
parents 4b417b776b95
children 06da0685077b
comparison
equal deleted inserted replaced
23981:05c1a8485fb9 23982:9fcd71d0db89
526 { 526 {
527 semsg(_(e_listidx), idx); 527 semsg(_(e_listidx), idx);
528 return NULL; 528 return NULL;
529 } 529 }
530 return tv_get_string(&li->li_tv); 530 return tv_get_string(&li->li_tv);
531 }
532
533 /*
534 * Like list_find() but when a negative index is used that is not found use
535 * zero and set "idx" to zero. Used for first index of a range.
536 */
537 listitem_T *
538 list_find_index(list_T *l, long *idx)
539 {
540 listitem_T *li = list_find(l, *idx);
541
542 if (li == NULL)
543 {
544 if (*idx < 0)
545 {
546 *idx = 0;
547 li = list_find(l, *idx);
548 }
549 }
550 return li;
531 } 551 }
532 552
533 /* 553 /*
534 * Locate "item" list "l" and return its index. 554 * Locate "item" list "l" and return its index.
535 * Returns -1 when "item" is not in the list. 555 * Returns -1 when "item" is not in the list.