]>
Commit | Line | Data |
---|---|---|
ef75664d AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.1.248 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.1.248 | |
11 | Problem: Can't set the '" mark. Can't know if setpos() was successful. | |
12 | Solution: Allow setting the '" mark with setpos(). Have setpos() return a | |
13 | value indicating success/failure. | |
14 | Files: runtime/doc/eval.txt, src/eval.c, src/mark.c | |
15 | ||
16 | ||
17 | *** ../vim-7.1.247/runtime/doc/eval.txt Sat Jan 12 16:45:25 2008 | |
18 | --- runtime/doc/eval.txt Wed Feb 13 11:49:16 2008 | |
19 | *************** | |
20 | *** 1,4 **** | |
21 | ! *eval.txt* For Vim version 7.1. Last change: 2008 Jan 11 | |
22 | ||
23 | ||
24 | VIM REFERENCE MANUAL by Bram Moolenaar | |
25 | --- 1,4 ---- | |
26 | ! *eval.txt* For Vim version 7.1. Last change: 2008 Feb 13 | |
27 | ||
28 | ||
29 | VIM REFERENCE MANUAL by Bram Moolenaar | |
30 | *************** | |
31 | *** 4523,4528 **** | |
32 | --- 4528,4536 ---- | |
33 | character. E.g., a position within a <Tab> or after the last | |
34 | character. | |
35 | ||
36 | + Returns 0 when the position could be set, -1 otherwise. | |
37 | + An error message is given if {expr} is invalid. | |
38 | + | |
39 | Also see |getpos()| | |
40 | ||
41 | This does not restore the preferred column for moving | |
42 | *** ../vim-7.1.247/src/eval.c Tue Jan 22 11:58:41 2008 | |
43 | --- src/eval.c Wed Feb 13 11:54:09 2008 | |
44 | *************** | |
45 | *** 14776,14799 **** | |
46 | int fnum; | |
47 | char_u *name; | |
48 | ||
49 | name = get_tv_string_chk(argvars); | |
50 | if (name != NULL) | |
51 | { | |
52 | if (list2fpos(&argvars[1], &pos, &fnum) == OK) | |
53 | { | |
54 | --pos.col; | |
55 | ! if (name[0] == '.') /* cursor */ | |
56 | { | |
57 | if (fnum == curbuf->b_fnum) | |
58 | { | |
59 | curwin->w_cursor = pos; | |
60 | check_cursor(); | |
61 | } | |
62 | else | |
63 | EMSG(_(e_invarg)); | |
64 | } | |
65 | ! else if (name[0] == '\'') /* mark */ | |
66 | ! (void)setmark_pos(name[1], &pos, fnum); | |
67 | else | |
68 | EMSG(_(e_invarg)); | |
69 | } | |
70 | --- 14778,14808 ---- | |
71 | int fnum; | |
72 | char_u *name; | |
73 | ||
74 | + rettv->vval.v_number = -1; | |
75 | name = get_tv_string_chk(argvars); | |
76 | if (name != NULL) | |
77 | { | |
78 | if (list2fpos(&argvars[1], &pos, &fnum) == OK) | |
79 | { | |
80 | --pos.col; | |
81 | ! if (name[0] == '.' && name[1] == NUL) | |
82 | { | |
83 | + /* set cursor */ | |
84 | if (fnum == curbuf->b_fnum) | |
85 | { | |
86 | curwin->w_cursor = pos; | |
87 | check_cursor(); | |
88 | + rettv->vval.v_number = 0; | |
89 | } | |
90 | else | |
91 | EMSG(_(e_invarg)); | |
92 | } | |
93 | ! else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) | |
94 | ! { | |
95 | ! /* set mark */ | |
96 | ! if (setmark_pos(name[1], &pos, fnum) == OK) | |
97 | ! rettv->vval.v_number = 0; | |
98 | ! } | |
99 | else | |
100 | EMSG(_(e_invarg)); | |
101 | } | |
102 | *** ../vim-7.1.247/src/mark.c Thu Jan 3 20:21:34 2008 | |
103 | --- src/mark.c Wed Feb 13 11:42:30 2008 | |
104 | *************** | |
105 | *** 79,84 **** | |
106 | --- 79,90 ---- | |
107 | return OK; | |
108 | } | |
109 | ||
110 | + if (c == '"') | |
111 | + { | |
112 | + curbuf->b_last_cursor = *pos; | |
113 | + return OK; | |
114 | + } | |
115 | + | |
116 | /* Allow setting '[ and '] for an autocommand that simulates reading a | |
117 | * file. */ | |
118 | if (c == '[') | |
119 | *** ../vim-7.1.247/src/version.c Wed Feb 13 10:57:11 2008 | |
120 | --- src/version.c Wed Feb 13 12:39:23 2008 | |
121 | *************** | |
122 | *** 668,669 **** | |
123 | --- 668,671 ---- | |
124 | { /* Add new patch number below this line */ | |
125 | + /**/ | |
126 | + 248, | |
127 | /**/ | |
128 | ||
129 | -- | |
130 | "Making it up? Why should I want to make anything up? Life's bad enough | |
131 | as it is without wanting to invent any more of it." | |
132 | -- Marvin, the Paranoid Android in Douglas Adams' | |
133 | "The Hitchhiker's Guide to the Galaxy" | |
134 | ||
135 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
136 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
137 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
138 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |