From ba17ea669663a76bd2f2d3f9efcaa1128187bae7 Mon Sep 17 00:00:00 2001 From: edyfox Date: Wed, 13 Feb 2008 14:13:14 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@878 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- runtime/doc/eval.txt | 5 ++++- src/eval.c | 13 ++++++++++--- src/mark.c | 6 ++++++ src/version.c | 2 ++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 5a665c36..7acf740e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*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 @@ -4523,6 +4523,9 @@ setpos({expr}, {list}) character. E.g., a position within a 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 diff --git a/src/eval.c b/src/eval.c index 7093051b..0f2461e1 100644 --- a/src/eval.c +++ b/src/eval.c @@ -14776,24 +14776,31 @@ f_setpos(argvars, rettv) 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)); } diff --git a/src/mark.c b/src/mark.c index 6dc59344..2accbba1 100644 --- a/src/mark.c +++ b/src/mark.c @@ -79,6 +79,12 @@ setmark_pos(c, pos, fnum) return OK; } + if (c == '"') + { + curbuf->b_last_cursor = *pos; + return OK; + } + /* Allow setting '[ and '] for an autocommand that simulates reading a * file. */ if (c == '[') diff --git a/src/version.c b/src/version.c index 740c1358..d6046666 100644 --- a/src/version.c +++ b/src/version.c @@ -667,6 +667,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 248, +/**/ 247, /**/ 246, -- 2.11.4.GIT