Hi Bram,
2016-1-15(Fri) 7:03:39 UTC+9 Bram Moolenaar:
> Hirohito Higashi wrote:
>
> > Hi Bram,
> >
> > 2015-12-29(Tue) 3:21:01 UTC+9 Bram Moolenaar:
> > > Patch 7.4.984
> > > Problem: searchpos() always starts searching in the first column,
> > > which is
> > > not what some people expect. (Brett Stahlman)
> > > Solution: Add the 'z' flag: start at the specified column.
> > > Files: src/vim.h, src/eval.c, src/search.c,
> > > src/testdir/test_searchpos.vim, src/testdir/test_alot.vim,
> > > runtime/doc/eval.txt
>
> [...]
>
> > I found a typo in src/testdir/test_searchpos.vim.
> > Please check and fix this.
> > Patch is attached.
>
> Thanks. Why doesn't this cause an error? I think we should verify
> cursor() has two arguments.
cursor() has two of usage.
doc> cursor({lnum}, {col} [, {off}])
doc> cursor({list})
Check whether the list type, when single argument.
How about attached patch?
--
Best regards,
Hirohito Higashi (a.k.a h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/eval.c b/src/eval.c
index dd19492..bf897c2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -10234,6 +10234,12 @@ f_cursor(argvars, rettv)
pos_T pos;
colnr_T curswant = -1;
+ if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL)
+ {
+ EMSG(_(e_listreq));
+ return;
+ }
+
if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL)
return;
line = pos.lnum;
diff --git a/src/testdir/test_searchpos.vim b/src/testdir/test_searchpos.vim
index 4a1e024..8dffddc 100644
--- a/src/testdir/test_searchpos.vim
+++ b/src/testdir/test_searchpos.vim
@@ -15,10 +15,10 @@ func Test_searchpos()
call assert_equal([1, 3, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}xyz', 'pcW'))
" Now with \zs, first match is in column 0, "a" is matched.
- call cursor(1. 3)
+ call cursor(1, 3)
call assert_equal([2, 4, 2], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcW'))
" With z flag start at cursor column, don't see the "a".
- call cursor(1. 3)
+ call cursor(1, 3)
call assert_equal([2, 4, 1], searchpos('\%(\([a-z]\)\|\_.\)\{-}\zsxyz', 'pcWz'))
set cpo+=c