diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-12-27 20:57:06 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-27 20:57:06 +0000 |
commit | 8dac2acd6a79d571ff5409d9c90b4c9e73237eb4 (patch) | |
tree | 1d3712aff207fc834fb5aa8dc5afc2a394fc7788 /src/eval.c | |
parent | 4b28ba3245df8274303c79429972f9dc9438e4aa (diff) |
patch 8.2.3916: no error for passing an invalid line number to append()v8.2.3916
Problem: No error for passing an invalid line number to append().
Solution: In Vim9 script check for a non-negative number. (closes #9417)
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index 4e720e8e23..40a5910461 100644 --- a/src/eval.c +++ b/src/eval.c @@ -5359,8 +5359,9 @@ var2fpos( name = tv_get_string_chk(varp); if (name == NULL) return NULL; - if (name[0] == '.') // cursor + if (name[0] == '.' && (!in_vim9script() || name[1] == NUL)) { + // cursor pos = curwin->w_cursor; if (charcol) pos.col = buf_byteidx_to_charidx(curbuf, pos.lnum, pos.col); @@ -5376,8 +5377,10 @@ var2fpos( pos.col = buf_byteidx_to_charidx(curbuf, pos.lnum, pos.col); return &pos; } - if (name[0] == '\'') // mark + if (name[0] == '\'' && (!in_vim9script() + || (name[1] != NUL && name[2] == NUL))) { + // mark pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum); if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0) return NULL; |