mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 10:56:31 +00:00
vim-patch:8.2.3336: behavior of negative index in list change changed
Problem: Behavior of negative index in list change changed. (Naruhiko
Nishino)
Solution: Only change it for Vim9 script. (closes vim/vim#8749)
92f05f21af
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -787,15 +787,15 @@ int tv_list_slice_or_index(list_T *list, bool range, int n1_arg, int n2_arg, typ
|
||||
n1 = len + n1;
|
||||
}
|
||||
if (n1 < 0 || n1 >= len) {
|
||||
// For a range we allow invalid values and return an empty
|
||||
// list. A list index out of range is an error.
|
||||
// For a range we allow invalid values and return an empty list.
|
||||
// A list index out of range is an error.
|
||||
if (!range) {
|
||||
if (verbose) {
|
||||
semsg(_(e_listidx), (int64_t)n1);
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
n1 = n1 < 0 ? 0 : len;
|
||||
n1 = len;
|
||||
}
|
||||
if (range) {
|
||||
if (n2 < 0) {
|
||||
|
Reference in New Issue
Block a user