-*eval.txt* For Vim version 7.1. Last change: 2008 Jan 11
+*eval.txt* For Vim version 7.1. Last change: 2008 Feb 13
VIM REFERENCE MANUAL by Bram Moolenaar
character. E.g., a position within a <Tab> or after the last
character.
+ Returns 0 when the position could be set, -1 otherwise.
+ An error message is given if {expr} is invalid.
+
Also see |getpos()|
This does not restore the preferred column for moving
int fnum;
char_u *name;
+ rettv->vval.v_number = -1;
name = get_tv_string_chk(argvars);
if (name != NULL)
{
if (list2fpos(&argvars[1], &pos, &fnum) == OK)
{
--pos.col;
- if (name[0] == '.') /* cursor */
+ if (name[0] == '.' && name[1] == NUL)
{
+ /* set cursor */
if (fnum == curbuf->b_fnum)
{
curwin->w_cursor = pos;
check_cursor();
+ rettv->vval.v_number = 0;
}
else
EMSG(_(e_invarg));
}
- else if (name[0] == '\'') /* mark */
- (void)setmark_pos(name[1], &pos, fnum);
+ else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL)
+ {
+ /* set mark */
+ if (setmark_pos(name[1], &pos, fnum) == OK)
+ rettv->vval.v_number = 0;
+ }
else
EMSG(_(e_invarg));
}