commit 5c9f6bdd8c0486ccc3fd1b6b408e7ced90bdbc5a
parent 9c272b75ecf955afe7feedc209f5d9a3b7116650
Author: zeertzjq <zeertzjq@outlook.com>
Date: Mon, 10 Oct 2022 21:17:17 +0800
vim-patch:8.2.2671: error for line number in legacy script
Problem: Error for line number in legacy script.
Solution: Check for number type.
https://github.com/vim/vim/commit/f6bdd82c7e2076dbacb764a5d288189d61c68451
N/A patches for version.c:
vim-patch:8.2.2670: Vim9: error for append(0, text)
Problem: Vim9: error for append(0, text).
Solution: Check for negative number. (closes vim/vim#8022)
https://github.com/vim/vim/commit/b2ac7d0663ef31a335c50c6afca042ed9ace5059
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
@@ -3751,8 +3751,9 @@ linenr_T tv_get_lnum(const typval_T *const tv)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
linenr_T lnum = (linenr_T)tv_get_number_chk(tv, NULL);
- if (lnum <= 0) { // No valid number, try using same function as line() does.
+ if (lnum <= 0 && tv->v_type != VAR_NUMBER) {
int fnum;
+ // No valid number, try using same function as line() does.
pos_T *const fp = var2fpos(tv, true, &fnum, false);
if (fp != NULL) {
lnum = fp->lnum;