]> git.pld-linux.org Git - packages/vim.git/blame - 7.1.031
- updated to 0.7.5
[packages/vim.git] / 7.1.031
CommitLineData
ad28a8ff
AG
1To: vim-dev@vim.org
2Subject: patch 7.1.031
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=ISO-8859-1
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.1.031
11Problem: virtcol([123, '$']) doesn't work. (Michael Schaap)
12Solution: When '$' is used for the column number get the last column.
13Files: runtime/doc/eval.txt, src/eval.c
14
15
16*** ../vim-7.1.030/runtime/doc/eval.txt Tue Jun 19 17:23:46 2007
17--- runtime/doc/eval.txt Wed Jul 11 21:21:28 2007
18***************
19*** 1,4 ****
20! *eval.txt* For Vim version 7.1. Last change: 2007 Jun 09
21
22
23 VIM REFERENCE MANUAL by Bram Moolenaar
24--- 1,4 ----
25! *eval.txt* For Vim version 7.1. Last change: 2007 Jul 11
26
27
28 VIM REFERENCE MANUAL by Bram Moolenaar
29***************
30*** 2020,2025 ****
31--- 2020,2029 ----
32 number of characters in the cursor line plus one)
33 'x position of mark x (if the mark is not set, 0 is
34 returned)
35+ Additionally {expr} can be [lnum, col]: a |List| with the line
36+ and column number. Most useful when the column is "$", to get
37+ the las column of a specific line. When "lnum" or "col" is
38+ out of range then col() returns zero.
39 To get the line number use |line()|. To get both use
40 |getpos()|.
41 For the screen column position use |virtcol()|.
42***************
43*** 5024,5037 ****
44 position, the returned Number will be the column at the end of
45 the <Tab>. For example, for a <Tab> in column 1, with 'ts'
46 set to 8, it returns 8.
47! For the use of {expr} see |col()|. Additionally you can use
48! [lnum, col]: a |List| with the line and column number. When
49! "lnum" or "col" is out of range then virtcol() returns zero.
50! When 'virtualedit' is used it can be [lnum, col, off], where
51 "off" is the offset in screen columns from the start of the
52 character. E.g., a position within a <Tab> or after the last
53 character.
54- For the byte position use |col()|.
55 When Virtual editing is active in the current mode, a position
56 beyond the end of the line can be returned. |'virtualedit'|
57 The accepted positions are:
58--- 5029,5040 ----
59 position, the returned Number will be the column at the end of
60 the <Tab>. For example, for a <Tab> in column 1, with 'ts'
61 set to 8, it returns 8.
62! For the byte position use |col()|.
63! For the use of {expr} see |col()|.
64! When 'virtualedit' is used {expr} can be [lnum, col, off], where
65 "off" is the offset in screen columns from the start of the
66 character. E.g., a position within a <Tab> or after the last
67 character.
68 When Virtual editing is active in the current mode, a position
69 beyond the end of the line can be returned. |'virtualedit'|
70 The accepted positions are:
71*** ../vim-7.1.030/src/eval.c Tue Jul 10 13:27:46 2007
72--- src/eval.c Wed Jul 11 19:50:27 2007
73***************
74*** 672,678 ****
75 static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv));
76
77 static int list2fpos __ARGS((typval_T *arg, pos_T *posp, int *fnump));
78! static pos_T *var2fpos __ARGS((typval_T *varp, int lnum, int *fnum));
79 static int get_env_len __ARGS((char_u **arg));
80 static int get_id_len __ARGS((char_u **arg));
81 static int get_name_len __ARGS((char_u **arg, char_u **alias, int evaluate, int verbose));
82--- 672,678 ----
83 static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv));
84
85 static int list2fpos __ARGS((typval_T *arg, pos_T *posp, int *fnump));
86! static pos_T *var2fpos __ARGS((typval_T *varp, int dollar_lnum, int *fnum));
87 static int get_env_len __ARGS((char_u **arg));
88 static int get_id_len __ARGS((char_u **arg));
89 static int get_name_len __ARGS((char_u **arg, char_u **alias, int evaluate, int verbose));
90***************
91*** 16505,16513 ****
92 * Returns NULL when there is an error.
93 */
94 static pos_T *
95! var2fpos(varp, lnum, fnum)
96 typval_T *varp;
97! int lnum; /* TRUE when $ is last line */
98 int *fnum; /* set to fnum for '0, 'A, etc. */
99 {
100 char_u *name;
101--- 16508,16516 ----
102 * Returns NULL when there is an error.
103 */
104 static pos_T *
105! var2fpos(varp, dollar_lnum, fnum)
106 typval_T *varp;
107! int dollar_lnum; /* TRUE when $ is last line */
108 int *fnum; /* set to fnum for '0, 'A, etc. */
109 {
110 char_u *name;
111***************
112*** 16520,16525 ****
113--- 16523,16529 ----
114 list_T *l;
115 int len;
116 int error = FALSE;
117+ listitem_T *li;
118
119 l = varp->vval.v_list;
120 if (l == NULL)
121***************
122*** 16535,16540 ****
123--- 16539,16552 ----
124 if (error)
125 return NULL;
126 len = (long)STRLEN(ml_get(pos.lnum));
127+
128+ /* We accept "$" for the column number: last column. */
129+ li = list_find(l, 1L);
130+ if (li != NULL && li->li_tv.v_type == VAR_STRING
131+ && li->li_tv.vval.v_string != NULL
132+ && STRCMP(li->li_tv.vval.v_string, "$") == 0)
133+ pos.col = len + 1;
134+
135 /* Accept a position up to the NUL after the line. */
136 if (pos.col == 0 || (int)pos.col > len + 1)
137 return NULL; /* invalid column number */
138***************
139*** 16567,16573 ****
140 pos.coladd = 0;
141 #endif
142
143! if (name[0] == 'w' && lnum)
144 {
145 pos.col = 0;
146 if (name[1] == '0') /* "w0": first visible line */
147--- 16579,16585 ----
148 pos.coladd = 0;
149 #endif
150
151! if (name[0] == 'w' && dollar_lnum)
152 {
153 pos.col = 0;
154 if (name[1] == '0') /* "w0": first visible line */
155***************
156*** 16585,16591 ****
157 }
158 else if (name[0] == '$') /* last column or line */
159 {
160! if (lnum)
161 {
162 pos.lnum = curbuf->b_ml.ml_line_count;
163 pos.col = 0;
164--- 16597,16603 ----
165 }
166 else if (name[0] == '$') /* last column or line */
167 {
168! if (dollar_lnum)
169 {
170 pos.lnum = curbuf->b_ml.ml_line_count;
171 pos.col = 0;
172*** ../vim-7.1.030/src/version.c Tue Jul 17 14:32:07 2007
173--- src/version.c Tue Jul 17 16:24:54 2007
174***************
175*** 668,669 ****
176--- 668,671 ----
177 { /* Add new patch number below this line */
178+ /**/
179+ 31,
180 /**/
181
182--
183CRONE: Who sent you?
184ARTHUR: The Knights Who Say GNU!
185CRONE: Aaaagh! (she looks around in rear) No! We have no licenses here.
186 "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD
187
188 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
189/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
190\\\ download, build and distribute -- http://www.A-A-P.org ///
191 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
This page took 0.046841 seconds and 4 git commands to generate.