diff options
Diffstat (limited to 'src/typval.c')
-rw-r--r-- | src/typval.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/typval.c b/src/typval.c index 2f773b602..34ff47c0a 100644 --- a/src/typval.c +++ b/src/typval.c @@ -2249,9 +2249,10 @@ tv_get_lnum(typval_T *argvars) if (lnum <= 0 && argvars[0].v_type != VAR_NUMBER) { int fnum; - pos_T *fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE); + pos_T *fp; // no valid number, try using arg like line() + fp = var2fpos(&argvars[0], TRUE, &fnum, FALSE); if (fp != NULL) lnum = fp->lnum; } @@ -2269,6 +2270,7 @@ tv_get_lnum_buf(typval_T *argvars, buf_T *buf) if (argvars[0].v_type == VAR_STRING && argvars[0].vval.v_string != NULL && argvars[0].vval.v_string[0] == '$' + && argvars[0].vval.v_string[1] == NUL && buf != NULL) return buf->b_ml.ml_line_count; return (linenr_T)tv_get_number_chk(&argvars[0], NULL); |