summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/move.c5
-rw-r--r--src/testdir/test_cursor_func.vim3
-rw-r--r--src/version.c2
3 files changed, 10 insertions, 0 deletions
diff --git a/src/move.c b/src/move.c
index 7a9ae3ea6..954a13714 100644
--- a/src/move.c
+++ b/src/move.c
@@ -1500,6 +1500,11 @@ f_screenpos(typval_T *argvars UNUSED, typval_T *rettv)
return;
pos.lnum = tv_get_number(&argvars[1]);
+ if (pos.lnum > wp->w_buffer->b_ml.ml_line_count)
+ {
+ semsg(_(e_invalid_line_number_nr), pos.lnum);
+ return;
+ }
pos.col = tv_get_number(&argvars[2]) - 1;
pos.coladd = 0;
textpos2screenpos(wp, &pos, &row, &scol, &ccol, &ecol);
diff --git a/src/testdir/test_cursor_func.vim b/src/testdir/test_cursor_func.vim
index a48db15e6..8bdc956e2 100644
--- a/src/testdir/test_cursor_func.vim
+++ b/src/testdir/test_cursor_func.vim
@@ -167,6 +167,9 @@ func Test_screenpos_number()
let pos = screenpos(winid, 1, 66)
call assert_equal(winrow, pos.row)
call assert_equal(wincol + 66 + 3, pos.col)
+
+ call assert_fails('echo screenpos(0, 2, 1)', 'E966:')
+
close
bwipe!
endfunc
diff --git a/src/version.c b/src/version.c
index b8b346071..48bec3d9a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1011,
+/**/
1010,
/**/
1009,