Mercurial > vim
changeset 23642:8df4e9e2394f v8.2.2363
patch 8.2.2363: curpos() does not accept a string argument as before
Commit: https://github.com/vim/vim/commit/9ebcf231bdccc1673cc92b20f5190fc577ad29d0
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 16 16:52:49 2021 +0100
patch 8.2.2363: curpos() does not accept a string argument as before
Problem: curpos() does not accept a string argument as before.
solution: Make a string argument work again. (Yegappan Lakshmanan,
closes #7690
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 16 Jan 2021 17:00:03 +0100 |
parents | 4e25718651ae |
children | df929ddb388b |
files | src/evalfunc.c src/testdir/test_cursor_func.vim src/version.c |
diffstat | 3 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -2767,7 +2767,8 @@ set_cursorpos(typval_T *argvars, typval_ } else if ((argvars[0].v_type == VAR_NUMBER || argvars[0].v_type == VAR_STRING) - && argvars[1].v_type == VAR_NUMBER) + && (argvars[1].v_type == VAR_NUMBER || + argvars[1].v_type == VAR_STRING)) { line = tv_get_lnum(argvars); if (line < 0)
--- a/src/testdir/test_cursor_func.vim +++ b/src/testdir/test_cursor_func.vim @@ -25,6 +25,9 @@ func Test_move_cursor() " below last line goes to last line eval [9, 1]->cursor() call assert_equal([4, 1, 0, 1], getcurpos()[1:]) + " pass string arguments + call cursor('3', '3') + call assert_equal([3, 3, 0, 3], getcurpos()[1:]) call setline(1, ["\<TAB>"]) call cursor(1, 1, 1)