Mercurial > vim
diff src/evalfunc.c @ 23276:b79cdad3ea2e v8.2.2184
patch 8.2.2184: Vim9: no error when using "2" for a line number
Commit: https://github.com/vim/vim/commit/9a963377b4811e4e0419ec8825856ff4b01331ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 21 21:58:46 2020 +0100
patch 8.2.2184: Vim9: no error when using "2" for a line number
Problem: Vim9: no error when using "2" for a line number.
Solution: Give an error message if the line number is invalid. (closes https://github.com/vim/vim/issues/7492)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 21 Dec 2020 22:00:03 +0100 |
parents | a8bccb0634bc |
children | 2351b40af967 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -2615,6 +2615,8 @@ f_cursor(typval_T *argvars, typval_T *re else { line = tv_get_lnum(argvars); + if (line < 0) + semsg(_(e_invarg2), tv_get_string(&argvars[0])); col = (long)tv_get_number_chk(&argvars[1], NULL); if (argvars[2].v_type != VAR_UNKNOWN) coladd = (long)tv_get_number_chk(&argvars[2], NULL);