Skip to content

Commit 24c4d53

Browse files
committed
patch 7.4.1093
Problem: Typo in test goes unnoticed. Solution: Fix the typo. Give error for wrong arguments to cursor(). (partly by Hirohito Higashi) Add a test for cursor().
1 parent a803c7f commit 24c4d53

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/eval.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10243,7 +10243,8 @@ f_cscope_connection(argvars, rettv)
1024310243
}
1024410244

1024510245
/*
10246-
* "cursor(lnum, col)" function
10246+
* "cursor(lnum, col)" function, or
10247+
* "cursor(list)"
1024710248
*
1024810249
* Moves the cursor to the specified line and column.
1024910250
* Returns 0 when the position could be set, -1 otherwise.
@@ -10266,7 +10267,10 @@ f_cursor(argvars, rettv)
1026610267
colnr_T curswant = -1;
1026710268

1026810269
if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL)
10270+
{
10271+
EMSG(_(e_invarg));
1026910272
return;
10273+
}
1027010274
line = pos.lnum;
1027110275
col = pos.col;
1027210276
#ifdef FEAT_VIRTUALEDIT

src/testdir/test_alot.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
" This makes testing go faster, since Vim doesn't need to restart.
33

44
source test_backspace_opt.vim
5+
source test_cursor_func.vim
56
source test_lispwords.vim
67
source test_menu.vim
78
source test_searchpos.vim

src/testdir/test_searchpos.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ func Test_searchpos()
1515
call assert_equal([1, 3, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW'))
1616

1717
" Now with \zs, first match is in column 0, "a" is matched.
18-
call cursor(1. 3)
18+
call cursor(1, 3)
1919
call assert_equal([2, 4, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcW'))
2020
" With z flag start at cursor column, don't see the "a".
21-
call cursor(1. 3)
21+
call cursor(1, 3)
2222
call assert_equal([2, 4, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcWz'))
2323

2424
set cpo+=c

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1093,
744746
/**/
745747
1092,
746748
/**/

0 commit comments

Comments
 (0)