Mercurial > vim
annotate src/mark.c @ 10000:233289599874 v7.4.2273
commit https://github.com/vim/vim/commit/3056735ae8a366aa7fcb51872520895251858637
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 27 21:25:44 2016 +0200
patch 7.4.2273
Problem: getwininfo() and getbufinfo() are inefficient.
Solution: Do not make a copy of all window/buffer-local options. Make it
possible to get them with gettabwinvar() or getbufvar().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 27 Aug 2016 21:30:06 +0200 |
parents | fd9727ae3c49 |
children | 4aead6a9b7a9 |
rev | line source |
---|---|
7 | 1 /* vi:set ts=8 sts=4 sw=4: |
2 * | |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 * See README.txt for an overview of the Vim source code. | |
8 */ | |
9 | |
10 /* | |
11 * mark.c: functions for setting marks and jumping to them | |
12 */ | |
13 | |
14 #include "vim.h" | |
15 | |
16 /* | |
17 * This file contains routines to maintain and manipulate marks. | |
18 */ | |
19 | |
20 /* | |
21 * If a named file mark's lnum is non-zero, it is valid. | |
22 * If a named file mark's fnum is non-zero, it is for an existing buffer, | |
23 * otherwise it is from .viminfo and namedfm[n].fname is the file name. | |
24 * There are marks 'A - 'Z (set by user) and '0 to '9 (set when writing | |
25 * viminfo). | |
26 */ | |
27 #define EXTRA_MARKS 10 /* marks 0-9 */ | |
28 static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; /* marks with file nr */ | |
29 | |
7803
37c929c4a073
commit https://github.com/vim/vim/commit/92b8b2d307e34117f146319872010b0ccc9d2713
Christian Brabandt <cb@256bit.org>
parents:
5735
diff
changeset
|
30 static void fname2fnum(xfmark_T *fm); |
37c929c4a073
commit https://github.com/vim/vim/commit/92b8b2d307e34117f146319872010b0ccc9d2713
Christian Brabandt <cb@256bit.org>
parents:
5735
diff
changeset
|
31 static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf); |
37c929c4a073
commit https://github.com/vim/vim/commit/92b8b2d307e34117f146319872010b0ccc9d2713
Christian Brabandt <cb@256bit.org>
parents:
5735
diff
changeset
|
32 static char_u *mark_line(pos_T *mp, int lead_len); |
37c929c4a073
commit https://github.com/vim/vim/commit/92b8b2d307e34117f146319872010b0ccc9d2713
Christian Brabandt <cb@256bit.org>
parents:
5735
diff
changeset
|
33 static void show_one_mark(int, char_u *, pos_T *, char_u *, int current); |
7 | 34 #ifdef FEAT_JUMPLIST |
7803
37c929c4a073
commit https://github.com/vim/vim/commit/92b8b2d307e34117f146319872010b0ccc9d2713
Christian Brabandt <cb@256bit.org>
parents:
5735
diff
changeset
|
35 static void cleanup_jumplist(void); |
7 | 36 #endif |
37 #ifdef FEAT_VIMINFO | |
7803
37c929c4a073
commit https://github.com/vim/vim/commit/92b8b2d307e34117f146319872010b0ccc9d2713
Christian Brabandt <cb@256bit.org>
parents:
5735
diff
changeset
|
38 static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2); |
7 | 39 #endif |
40 | |
41 /* | |
706 | 42 * Set named mark "c" at current cursor position. |
7 | 43 * Returns OK on success, FAIL if bad name given. |
44 */ | |
45 int | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
46 setmark(int c) |
7 | 47 { |
706 | 48 return setmark_pos(c, &curwin->w_cursor, curbuf->b_fnum); |
49 } | |
50 | |
51 /* | |
52 * Set named mark "c" to position "pos". | |
53 * When "c" is upper case use file "fnum". | |
54 * Returns OK on success, FAIL if bad name given. | |
55 */ | |
56 int | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
57 setmark_pos(int c, pos_T *pos, int fnum) |
706 | 58 { |
7 | 59 int i; |
60 | |
61 /* Check for a special key (may cause islower() to crash). */ | |
62 if (c < 0) | |
63 return FAIL; | |
64 | |
65 if (c == '\'' || c == '`') | |
66 { | |
706 | 67 if (pos == &curwin->w_cursor) |
68 { | |
69 setpcmark(); | |
70 /* keep it even when the cursor doesn't move */ | |
71 curwin->w_prev_pcmark = curwin->w_pcmark; | |
72 } | |
73 else | |
74 curwin->w_pcmark = *pos; | |
7 | 75 return OK; |
76 } | |
77 | |
1533 | 78 if (c == '"') |
79 { | |
80 curbuf->b_last_cursor = *pos; | |
81 return OK; | |
82 } | |
83 | |
7 | 84 /* Allow setting '[ and '] for an autocommand that simulates reading a |
85 * file. */ | |
86 if (c == '[') | |
87 { | |
706 | 88 curbuf->b_op_start = *pos; |
7 | 89 return OK; |
90 } | |
91 if (c == ']') | |
92 { | |
706 | 93 curbuf->b_op_end = *pos; |
7 | 94 return OK; |
95 } | |
96 | |
5265
cd971e951b06
updated for version 7.4b.009
Bram Moolenaar <bram@vim.org>
parents:
4092
diff
changeset
|
97 if (c == '<' || c == '>') |
3660 | 98 { |
5265
cd971e951b06
updated for version 7.4b.009
Bram Moolenaar <bram@vim.org>
parents:
4092
diff
changeset
|
99 if (c == '<') |
cd971e951b06
updated for version 7.4b.009
Bram Moolenaar <bram@vim.org>
parents:
4092
diff
changeset
|
100 curbuf->b_visual.vi_start = *pos; |
cd971e951b06
updated for version 7.4b.009
Bram Moolenaar <bram@vim.org>
parents:
4092
diff
changeset
|
101 else |
cd971e951b06
updated for version 7.4b.009
Bram Moolenaar <bram@vim.org>
parents:
4092
diff
changeset
|
102 curbuf->b_visual.vi_end = *pos; |
cd971e951b06
updated for version 7.4b.009
Bram Moolenaar <bram@vim.org>
parents:
4092
diff
changeset
|
103 if (curbuf->b_visual.vi_mode == NUL) |
cd971e951b06
updated for version 7.4b.009
Bram Moolenaar <bram@vim.org>
parents:
4092
diff
changeset
|
104 /* Visual_mode has not yet been set, use a sane default. */ |
cd971e951b06
updated for version 7.4b.009
Bram Moolenaar <bram@vim.org>
parents:
4092
diff
changeset
|
105 curbuf->b_visual.vi_mode = 'v'; |
3660 | 106 return OK; |
107 } | |
108 | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
109 if (ASCII_ISLOWER(c)) |
7 | 110 { |
111 i = c - 'a'; | |
706 | 112 curbuf->b_namedm[i] = *pos; |
7 | 113 return OK; |
114 } | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
115 if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) |
7 | 116 { |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
117 if (VIM_ISDIGIT(c)) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
118 i = c - '0' + NMARKS; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
119 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
120 i = c - 'A'; |
706 | 121 namedfm[i].fmark.mark = *pos; |
122 namedfm[i].fmark.fnum = fnum; | |
7 | 123 vim_free(namedfm[i].fname); |
124 namedfm[i].fname = NULL; | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
125 #ifdef FEAT_VIMINFO |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
126 namedfm[i].time_set = vim_time(); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
127 #endif |
7 | 128 return OK; |
129 } | |
130 return FAIL; | |
131 } | |
132 | |
133 /* | |
134 * Set the previous context mark to the current position and add it to the | |
135 * jump list. | |
136 */ | |
137 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
138 setpcmark(void) |
7 | 139 { |
140 #ifdef FEAT_JUMPLIST | |
141 int i; | |
142 xfmark_T *fm; | |
143 #endif | |
144 #ifdef JUMPLIST_ROTATE | |
145 xfmark_T tempmark; | |
146 #endif | |
147 | |
148 /* for :global the mark is set only once */ | |
149 if (global_busy || listcmd_busy || cmdmod.keepjumps) | |
150 return; | |
151 | |
152 curwin->w_prev_pcmark = curwin->w_pcmark; | |
153 curwin->w_pcmark = curwin->w_cursor; | |
154 | |
155 #ifdef FEAT_JUMPLIST | |
156 # ifdef JUMPLIST_ROTATE | |
157 /* | |
158 * If last used entry is not at the top, put it at the top by rotating | |
159 * the stack until it is (the newer entries will be at the bottom). | |
160 * Keep one entry (the last used one) at the top. | |
161 */ | |
162 if (curwin->w_jumplistidx < curwin->w_jumplistlen) | |
163 ++curwin->w_jumplistidx; | |
164 while (curwin->w_jumplistidx < curwin->w_jumplistlen) | |
165 { | |
166 tempmark = curwin->w_jumplist[curwin->w_jumplistlen - 1]; | |
167 for (i = curwin->w_jumplistlen - 1; i > 0; --i) | |
168 curwin->w_jumplist[i] = curwin->w_jumplist[i - 1]; | |
169 curwin->w_jumplist[0] = tempmark; | |
170 ++curwin->w_jumplistidx; | |
171 } | |
172 # endif | |
173 | |
174 /* If jumplist is full: remove oldest entry */ | |
175 if (++curwin->w_jumplistlen > JUMPLISTSIZE) | |
176 { | |
177 curwin->w_jumplistlen = JUMPLISTSIZE; | |
178 vim_free(curwin->w_jumplist[0].fname); | |
179 for (i = 1; i < JUMPLISTSIZE; ++i) | |
180 curwin->w_jumplist[i - 1] = curwin->w_jumplist[i]; | |
181 } | |
182 curwin->w_jumplistidx = curwin->w_jumplistlen; | |
183 fm = &curwin->w_jumplist[curwin->w_jumplistlen - 1]; | |
184 | |
185 fm->fmark.mark = curwin->w_pcmark; | |
186 fm->fmark.fnum = curbuf->b_fnum; | |
187 fm->fname = NULL; | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
188 # ifdef FEAT_VIMINFO |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
189 fm->time_set = vim_time(); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
190 # endif |
7 | 191 #endif |
192 } | |
193 | |
194 /* | |
195 * To change context, call setpcmark(), then move the current position to | |
196 * where ever, then call checkpcmark(). This ensures that the previous | |
197 * context will only be changed if the cursor moved to a different line. | |
198 * If pcmark was deleted (with "dG") the previous mark is restored. | |
199 */ | |
200 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
201 checkpcmark(void) |
7 | 202 { |
203 if (curwin->w_prev_pcmark.lnum != 0 | |
204 && (equalpos(curwin->w_pcmark, curwin->w_cursor) | |
205 || curwin->w_pcmark.lnum == 0)) | |
206 { | |
207 curwin->w_pcmark = curwin->w_prev_pcmark; | |
208 curwin->w_prev_pcmark.lnum = 0; /* Show it has been checked */ | |
209 } | |
210 } | |
211 | |
212 #if defined(FEAT_JUMPLIST) || defined(PROTO) | |
213 /* | |
214 * move "count" positions in the jump list (count may be negative) | |
215 */ | |
216 pos_T * | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
217 movemark(int count) |
7 | 218 { |
219 pos_T *pos; | |
220 xfmark_T *jmp; | |
221 | |
222 cleanup_jumplist(); | |
223 | |
224 if (curwin->w_jumplistlen == 0) /* nothing to jump to */ | |
225 return (pos_T *)NULL; | |
226 | |
227 for (;;) | |
228 { | |
229 if (curwin->w_jumplistidx + count < 0 | |
230 || curwin->w_jumplistidx + count >= curwin->w_jumplistlen) | |
231 return (pos_T *)NULL; | |
232 | |
233 /* | |
234 * if first CTRL-O or CTRL-I command after a jump, add cursor position | |
1188 | 235 * to list. Careful: If there are duplicates (CTRL-O immediately after |
7 | 236 * starting Vim on a file), another entry may have been removed. |
237 */ | |
238 if (curwin->w_jumplistidx == curwin->w_jumplistlen) | |
239 { | |
240 setpcmark(); | |
241 --curwin->w_jumplistidx; /* skip the new entry */ | |
242 if (curwin->w_jumplistidx + count < 0) | |
243 return (pos_T *)NULL; | |
244 } | |
245 | |
246 curwin->w_jumplistidx += count; | |
247 | |
248 jmp = curwin->w_jumplist + curwin->w_jumplistidx; | |
249 if (jmp->fmark.fnum == 0) | |
250 fname2fnum(jmp); | |
251 if (jmp->fmark.fnum != curbuf->b_fnum) | |
252 { | |
253 /* jump to other file */ | |
254 if (buflist_findnr(jmp->fmark.fnum) == NULL) | |
255 { /* Skip this one .. */ | |
256 count += count < 0 ? -1 : 1; | |
257 continue; | |
258 } | |
259 if (buflist_getfile(jmp->fmark.fnum, jmp->fmark.mark.lnum, | |
260 0, FALSE) == FAIL) | |
261 return (pos_T *)NULL; | |
262 /* Set lnum again, autocommands my have changed it */ | |
263 curwin->w_cursor = jmp->fmark.mark; | |
264 pos = (pos_T *)-1; | |
265 } | |
266 else | |
267 pos = &(jmp->fmark.mark); | |
268 return pos; | |
269 } | |
270 } | |
271 | |
272 /* | |
273 * Move "count" positions in the changelist (count may be negative). | |
274 */ | |
275 pos_T * | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
276 movechangelist(int count) |
7 | 277 { |
278 int n; | |
279 | |
280 if (curbuf->b_changelistlen == 0) /* nothing to jump to */ | |
281 return (pos_T *)NULL; | |
282 | |
283 n = curwin->w_changelistidx; | |
284 if (n + count < 0) | |
285 { | |
286 if (n == 0) | |
287 return (pos_T *)NULL; | |
288 n = 0; | |
289 } | |
290 else if (n + count >= curbuf->b_changelistlen) | |
291 { | |
292 if (n == curbuf->b_changelistlen - 1) | |
293 return (pos_T *)NULL; | |
294 n = curbuf->b_changelistlen - 1; | |
295 } | |
296 else | |
297 n += count; | |
298 curwin->w_changelistidx = n; | |
299 return curbuf->b_changelist + n; | |
300 } | |
301 #endif | |
302 | |
303 /* | |
4043 | 304 * Find mark "c" in buffer pointed to by "buf". |
706 | 305 * If "changefile" is TRUE it's allowed to edit another file for '0, 'A, etc. |
306 * If "fnum" is not NULL store the fnum there for '0, 'A etc., don't edit | |
307 * another file. | |
7 | 308 * Returns: |
309 * - pointer to pos_T if found. lnum is 0 when mark not set, -1 when mark is | |
310 * in another file which can't be gotten. (caller needs to check lnum!) | |
311 * - NULL if there is no mark called 'c'. | |
312 * - -1 if mark is in other file and jumped there (only if changefile is TRUE) | |
313 */ | |
314 pos_T * | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
315 getmark_buf(buf_T *buf, int c, int changefile) |
4043 | 316 { |
317 return getmark_buf_fnum(buf, c, changefile, NULL); | |
318 } | |
319 | |
320 pos_T * | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
321 getmark(int c, int changefile) |
706 | 322 { |
4043 | 323 return getmark_buf_fnum(curbuf, c, changefile, NULL); |
706 | 324 } |
325 | |
326 pos_T * | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
327 getmark_buf_fnum( |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
328 buf_T *buf, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
329 int c, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
330 int changefile, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
331 int *fnum) |
7 | 332 { |
333 pos_T *posp; | |
334 pos_T *startp, *endp; | |
335 static pos_T pos_copy; | |
336 | |
337 posp = NULL; | |
338 | |
339 /* Check for special key, can't be a mark name and might cause islower() | |
340 * to crash. */ | |
341 if (c < 0) | |
342 return posp; | |
343 #ifndef EBCDIC | |
344 if (c > '~') /* check for islower()/isupper() */ | |
345 ; | |
346 else | |
347 #endif | |
348 if (c == '\'' || c == '`') /* previous context mark */ | |
349 { | |
350 pos_copy = curwin->w_pcmark; /* need to make a copy because */ | |
351 posp = &pos_copy; /* w_pcmark may be changed soon */ | |
352 } | |
353 else if (c == '"') /* to pos when leaving buffer */ | |
4043 | 354 posp = &(buf->b_last_cursor); |
7 | 355 else if (c == '^') /* to where Insert mode stopped */ |
4043 | 356 posp = &(buf->b_last_insert); |
7 | 357 else if (c == '.') /* to where last change was made */ |
4043 | 358 posp = &(buf->b_last_change); |
7 | 359 else if (c == '[') /* to start of previous operator */ |
4043 | 360 posp = &(buf->b_op_start); |
7 | 361 else if (c == ']') /* to end of previous operator */ |
4043 | 362 posp = &(buf->b_op_end); |
7 | 363 else if (c == '{' || c == '}') /* to previous/next paragraph */ |
364 { | |
365 pos_T pos; | |
366 oparg_T oa; | |
367 int slcb = listcmd_busy; | |
368 | |
369 pos = curwin->w_cursor; | |
370 listcmd_busy = TRUE; /* avoid that '' is changed */ | |
503 | 371 if (findpar(&oa.inclusive, |
372 c == '}' ? FORWARD : BACKWARD, 1L, NUL, FALSE)) | |
7 | 373 { |
374 pos_copy = curwin->w_cursor; | |
375 posp = &pos_copy; | |
376 } | |
377 curwin->w_cursor = pos; | |
378 listcmd_busy = slcb; | |
379 } | |
380 else if (c == '(' || c == ')') /* to previous/next sentence */ | |
381 { | |
382 pos_T pos; | |
383 int slcb = listcmd_busy; | |
384 | |
385 pos = curwin->w_cursor; | |
386 listcmd_busy = TRUE; /* avoid that '' is changed */ | |
387 if (findsent(c == ')' ? FORWARD : BACKWARD, 1L)) | |
388 { | |
389 pos_copy = curwin->w_cursor; | |
390 posp = &pos_copy; | |
391 } | |
392 curwin->w_cursor = pos; | |
393 listcmd_busy = slcb; | |
394 } | |
395 else if (c == '<' || c == '>') /* start/end of visual area */ | |
396 { | |
4043 | 397 startp = &buf->b_visual.vi_start; |
398 endp = &buf->b_visual.vi_end; | |
7 | 399 if ((c == '<') == lt(*startp, *endp)) |
400 posp = startp; | |
401 else | |
402 posp = endp; | |
403 /* | |
404 * For Visual line mode, set mark at begin or end of line | |
405 */ | |
4043 | 406 if (buf->b_visual.vi_mode == 'V') |
7 | 407 { |
408 pos_copy = *posp; | |
409 posp = &pos_copy; | |
410 if (c == '<') | |
411 pos_copy.col = 0; | |
412 else | |
413 pos_copy.col = MAXCOL; | |
414 #ifdef FEAT_VIRTUALEDIT | |
415 pos_copy.coladd = 0; | |
416 #endif | |
417 } | |
418 } | |
419 else if (ASCII_ISLOWER(c)) /* normal named mark */ | |
420 { | |
4043 | 421 posp = &(buf->b_namedm[c - 'a']); |
7 | 422 } |
423 else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) /* named file mark */ | |
424 { | |
425 if (VIM_ISDIGIT(c)) | |
426 c = c - '0' + NMARKS; | |
427 else | |
428 c -= 'A'; | |
429 posp = &(namedfm[c].fmark.mark); | |
430 | |
431 if (namedfm[c].fmark.fnum == 0) | |
432 fname2fnum(&namedfm[c]); | |
706 | 433 |
434 if (fnum != NULL) | |
435 *fnum = namedfm[c].fmark.fnum; | |
4043 | 436 else if (namedfm[c].fmark.fnum != buf->b_fnum) |
7 | 437 { |
706 | 438 /* mark is in another file */ |
7 | 439 posp = &pos_copy; |
440 | |
441 if (namedfm[c].fmark.mark.lnum != 0 | |
442 && changefile && namedfm[c].fmark.fnum) | |
443 { | |
444 if (buflist_getfile(namedfm[c].fmark.fnum, | |
445 (linenr_T)1, GETF_SETMARK, FALSE) == OK) | |
446 { | |
447 /* Set the lnum now, autocommands could have changed it */ | |
448 curwin->w_cursor = namedfm[c].fmark.mark; | |
449 return (pos_T *)-1; | |
450 } | |
451 pos_copy.lnum = -1; /* can't get file */ | |
452 } | |
453 else | |
454 pos_copy.lnum = 0; /* mark exists, but is not valid in | |
455 current buffer */ | |
456 } | |
457 } | |
458 | |
459 return posp; | |
460 } | |
461 | |
462 /* | |
463 * Search for the next named mark in the current file. | |
464 * | |
465 * Returns pointer to pos_T of the next mark or NULL if no mark is found. | |
466 */ | |
467 pos_T * | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
468 getnextmark( |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
469 pos_T *startpos, /* where to start */ |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
470 int dir, /* direction for search */ |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
471 int begin_line) |
7 | 472 { |
473 int i; | |
474 pos_T *result = NULL; | |
475 pos_T pos; | |
476 | |
477 pos = *startpos; | |
478 | |
479 /* When searching backward and leaving the cursor on the first non-blank, | |
480 * position must be in a previous line. | |
481 * When searching forward and leaving the cursor on the first non-blank, | |
482 * position must be in a next line. */ | |
483 if (dir == BACKWARD && begin_line) | |
484 pos.col = 0; | |
485 else if (dir == FORWARD && begin_line) | |
486 pos.col = MAXCOL; | |
487 | |
488 for (i = 0; i < NMARKS; i++) | |
489 { | |
490 if (curbuf->b_namedm[i].lnum > 0) | |
491 { | |
492 if (dir == FORWARD) | |
493 { | |
494 if ((result == NULL || lt(curbuf->b_namedm[i], *result)) | |
495 && lt(pos, curbuf->b_namedm[i])) | |
496 result = &curbuf->b_namedm[i]; | |
497 } | |
498 else | |
499 { | |
500 if ((result == NULL || lt(*result, curbuf->b_namedm[i])) | |
501 && lt(curbuf->b_namedm[i], pos)) | |
502 result = &curbuf->b_namedm[i]; | |
503 } | |
504 } | |
505 } | |
506 | |
507 return result; | |
508 } | |
509 | |
510 /* | |
511 * For an xtended filemark: set the fnum from the fname. | |
512 * This is used for marks obtained from the .viminfo file. It's postponed | |
513 * until the mark is used to avoid a long startup delay. | |
514 */ | |
515 static void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
516 fname2fnum(xfmark_T *fm) |
7 | 517 { |
518 char_u *p; | |
519 | |
520 if (fm->fname != NULL) | |
521 { | |
522 /* | |
523 * First expand "~/" in the file name to the home directory. | |
1480 | 524 * Don't expand the whole name, it may contain other '~' chars. |
7 | 525 */ |
1480 | 526 if (fm->fname[0] == '~' && (fm->fname[1] == '/' |
527 #ifdef BACKSLASH_IN_FILENAME | |
528 || fm->fname[1] == '\\' | |
529 #endif | |
530 )) | |
531 { | |
532 int len; | |
533 | |
534 expand_env((char_u *)"~/", NameBuff, MAXPATHL); | |
1570 | 535 len = (int)STRLEN(NameBuff); |
1480 | 536 vim_strncpy(NameBuff + len, fm->fname + 2, MAXPATHL - len - 1); |
537 } | |
538 else | |
539 vim_strncpy(NameBuff, fm->fname, MAXPATHL - 1); | |
540 | |
541 /* Try to shorten the file name. */ | |
7 | 542 mch_dirname(IObuff, IOSIZE); |
543 p = shorten_fname(NameBuff, IObuff); | |
544 | |
545 /* buflist_new() will call fmarks_check_names() */ | |
546 (void)buflist_new(NameBuff, p, (linenr_T)1, 0); | |
547 } | |
548 } | |
549 | |
550 /* | |
551 * Check all file marks for a name that matches the file name in buf. | |
552 * May replace the name with an fnum. | |
553 * Used for marks that come from the .viminfo file. | |
554 */ | |
555 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
556 fmarks_check_names(buf_T *buf) |
7 | 557 { |
558 char_u *name; | |
559 int i; | |
560 #ifdef FEAT_JUMPLIST | |
561 win_T *wp; | |
562 #endif | |
563 | |
564 if (buf->b_ffname == NULL) | |
565 return; | |
566 | |
567 name = home_replace_save(buf, buf->b_ffname); | |
568 if (name == NULL) | |
569 return; | |
570 | |
571 for (i = 0; i < NMARKS + EXTRA_MARKS; ++i) | |
572 fmarks_check_one(&namedfm[i], name, buf); | |
573 | |
574 #ifdef FEAT_JUMPLIST | |
575 FOR_ALL_WINDOWS(wp) | |
576 { | |
577 for (i = 0; i < wp->w_jumplistlen; ++i) | |
578 fmarks_check_one(&wp->w_jumplist[i], name, buf); | |
579 } | |
580 #endif | |
581 | |
582 vim_free(name); | |
583 } | |
584 | |
585 static void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
586 fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf) |
7 | 587 { |
588 if (fm->fmark.fnum == 0 | |
589 && fm->fname != NULL | |
590 && fnamecmp(name, fm->fname) == 0) | |
591 { | |
592 fm->fmark.fnum = buf->b_fnum; | |
593 vim_free(fm->fname); | |
594 fm->fname = NULL; | |
595 } | |
596 } | |
597 | |
598 /* | |
599 * Check a if a position from a mark is valid. | |
600 * Give and error message and return FAIL if not. | |
601 */ | |
602 int | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
603 check_mark(pos_T *pos) |
7 | 604 { |
605 if (pos == NULL) | |
606 { | |
607 EMSG(_(e_umark)); | |
608 return FAIL; | |
609 } | |
610 if (pos->lnum <= 0) | |
611 { | |
612 /* lnum is negative if mark is in another file can can't get that | |
613 * file, error message already give then. */ | |
614 if (pos->lnum == 0) | |
615 EMSG(_(e_marknotset)); | |
616 return FAIL; | |
617 } | |
618 if (pos->lnum > curbuf->b_ml.ml_line_count) | |
619 { | |
620 EMSG(_(e_markinval)); | |
621 return FAIL; | |
622 } | |
623 return OK; | |
624 } | |
625 | |
626 /* | |
627 * clrallmarks() - clear all marks in the buffer 'buf' | |
628 * | |
629 * Used mainly when trashing the entire buffer during ":e" type commands | |
630 */ | |
631 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
632 clrallmarks(buf_T *buf) |
7 | 633 { |
634 static int i = -1; | |
635 | |
636 if (i == -1) /* first call ever: initialize */ | |
637 for (i = 0; i < NMARKS + 1; i++) | |
638 { | |
639 namedfm[i].fmark.mark.lnum = 0; | |
640 namedfm[i].fname = NULL; | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
641 #ifdef FEAT_VIMINFO |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
642 namedfm[i].time_set = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
643 #endif |
7 | 644 } |
645 | |
646 for (i = 0; i < NMARKS; i++) | |
647 buf->b_namedm[i].lnum = 0; | |
648 buf->b_op_start.lnum = 0; /* start/end op mark cleared */ | |
649 buf->b_op_end.lnum = 0; | |
650 buf->b_last_cursor.lnum = 1; /* '" mark cleared */ | |
651 buf->b_last_cursor.col = 0; | |
652 #ifdef FEAT_VIRTUALEDIT | |
653 buf->b_last_cursor.coladd = 0; | |
654 #endif | |
655 buf->b_last_insert.lnum = 0; /* '^ mark cleared */ | |
656 buf->b_last_change.lnum = 0; /* '. mark cleared */ | |
657 #ifdef FEAT_JUMPLIST | |
658 buf->b_changelistlen = 0; | |
659 #endif | |
660 } | |
661 | |
662 /* | |
663 * Get name of file from a filemark. | |
664 * When it's in the current buffer, return the text at the mark. | |
665 * Returns an allocated string. | |
666 */ | |
667 char_u * | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
668 fm_getname(fmark_T *fmark, int lead_len) |
7 | 669 { |
670 if (fmark->fnum == curbuf->b_fnum) /* current buffer */ | |
671 return mark_line(&(fmark->mark), lead_len); | |
672 return buflist_nr2name(fmark->fnum, FALSE, TRUE); | |
673 } | |
674 | |
675 /* | |
676 * Return the line at mark "mp". Truncate to fit in window. | |
677 * The returned string has been allocated. | |
678 */ | |
679 static char_u * | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
680 mark_line(pos_T *mp, int lead_len) |
7 | 681 { |
682 char_u *s, *p; | |
683 int len; | |
684 | |
685 if (mp->lnum == 0 || mp->lnum > curbuf->b_ml.ml_line_count) | |
686 return vim_strsave((char_u *)"-invalid-"); | |
687 s = vim_strnsave(skipwhite(ml_get(mp->lnum)), (int)Columns); | |
688 if (s == NULL) | |
689 return NULL; | |
690 /* Truncate the line to fit it in the window */ | |
691 len = 0; | |
39 | 692 for (p = s; *p != NUL; mb_ptr_adv(p)) |
7 | 693 { |
694 len += ptr2cells(p); | |
695 if (len >= Columns - lead_len) | |
696 break; | |
697 } | |
698 *p = NUL; | |
699 return s; | |
700 } | |
701 | |
702 /* | |
703 * print the marks | |
704 */ | |
705 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
706 do_marks(exarg_T *eap) |
7 | 707 { |
708 char_u *arg = eap->arg; | |
709 int i; | |
710 char_u *name; | |
711 | |
712 if (arg != NULL && *arg == NUL) | |
713 arg = NULL; | |
714 | |
715 show_one_mark('\'', arg, &curwin->w_pcmark, NULL, TRUE); | |
716 for (i = 0; i < NMARKS; ++i) | |
717 show_one_mark(i + 'a', arg, &curbuf->b_namedm[i], NULL, TRUE); | |
718 for (i = 0; i < NMARKS + EXTRA_MARKS; ++i) | |
719 { | |
720 if (namedfm[i].fmark.fnum != 0) | |
721 name = fm_getname(&namedfm[i].fmark, 15); | |
722 else | |
723 name = namedfm[i].fname; | |
724 if (name != NULL) | |
725 { | |
726 show_one_mark(i >= NMARKS ? i - NMARKS + '0' : i + 'A', | |
727 arg, &namedfm[i].fmark.mark, name, | |
728 namedfm[i].fmark.fnum == curbuf->b_fnum); | |
729 if (namedfm[i].fmark.fnum != 0) | |
730 vim_free(name); | |
731 } | |
732 } | |
733 show_one_mark('"', arg, &curbuf->b_last_cursor, NULL, TRUE); | |
734 show_one_mark('[', arg, &curbuf->b_op_start, NULL, TRUE); | |
735 show_one_mark(']', arg, &curbuf->b_op_end, NULL, TRUE); | |
736 show_one_mark('^', arg, &curbuf->b_last_insert, NULL, TRUE); | |
737 show_one_mark('.', arg, &curbuf->b_last_change, NULL, TRUE); | |
690 | 738 show_one_mark('<', arg, &curbuf->b_visual.vi_start, NULL, TRUE); |
739 show_one_mark('>', arg, &curbuf->b_visual.vi_end, NULL, TRUE); | |
7 | 740 show_one_mark(-1, arg, NULL, NULL, FALSE); |
741 } | |
742 | |
743 static void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
744 show_one_mark( |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
745 int c, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
746 char_u *arg, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
747 pos_T *p, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
748 char_u *name, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
749 int current) /* in current file */ |
7 | 750 { |
751 static int did_title = FALSE; | |
752 int mustfree = FALSE; | |
753 | |
754 if (c == -1) /* finish up */ | |
755 { | |
756 if (did_title) | |
757 did_title = FALSE; | |
758 else | |
759 { | |
760 if (arg == NULL) | |
761 MSG(_("No marks set")); | |
762 else | |
763 EMSG2(_("E283: No marks matching \"%s\""), arg); | |
764 } | |
765 } | |
766 /* don't output anything if 'q' typed at --more-- prompt */ | |
767 else if (!got_int | |
768 && (arg == NULL || vim_strchr(arg, c) != NULL) | |
769 && p->lnum != 0) | |
770 { | |
771 if (!did_title) | |
772 { | |
773 /* Highlight title */ | |
774 MSG_PUTS_TITLE(_("\nmark line col file/text")); | |
775 did_title = TRUE; | |
776 } | |
777 msg_putchar('\n'); | |
778 if (!got_int) | |
779 { | |
780 sprintf((char *)IObuff, " %c %6ld %4d ", c, p->lnum, p->col); | |
781 msg_outtrans(IObuff); | |
782 if (name == NULL && current) | |
783 { | |
784 name = mark_line(p, 15); | |
785 mustfree = TRUE; | |
786 } | |
787 if (name != NULL) | |
788 { | |
789 msg_outtrans_attr(name, current ? hl_attr(HLF_D) : 0); | |
790 if (mustfree) | |
791 vim_free(name); | |
792 } | |
793 } | |
794 out_flush(); /* show one line at a time */ | |
795 } | |
796 } | |
797 | |
24 | 798 /* |
799 * ":delmarks[!] [marks]" | |
800 */ | |
801 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
802 ex_delmarks(exarg_T *eap) |
24 | 803 { |
804 char_u *p; | |
805 int from, to; | |
806 int i; | |
807 int lower; | |
808 int digit; | |
809 int n; | |
810 | |
811 if (*eap->arg == NUL && eap->forceit) | |
812 /* clear all marks */ | |
813 clrallmarks(curbuf); | |
814 else if (eap->forceit) | |
815 EMSG(_(e_invarg)); | |
816 else if (*eap->arg == NUL) | |
817 EMSG(_(e_argreq)); | |
818 else | |
819 { | |
820 /* clear specified marks only */ | |
821 for (p = eap->arg; *p != NUL; ++p) | |
822 { | |
823 lower = ASCII_ISLOWER(*p); | |
824 digit = VIM_ISDIGIT(*p); | |
825 if (lower || digit || ASCII_ISUPPER(*p)) | |
826 { | |
827 if (p[1] == '-') | |
828 { | |
829 /* clear range of marks */ | |
830 from = *p; | |
831 to = p[2]; | |
832 if (!(lower ? ASCII_ISLOWER(p[2]) | |
833 : (digit ? VIM_ISDIGIT(p[2]) | |
834 : ASCII_ISUPPER(p[2]))) | |
835 || to < from) | |
836 { | |
837 EMSG2(_(e_invarg2), p); | |
838 return; | |
839 } | |
840 p += 2; | |
841 } | |
842 else | |
843 /* clear one lower case mark */ | |
844 from = to = *p; | |
845 | |
846 for (i = from; i <= to; ++i) | |
847 { | |
848 if (lower) | |
849 curbuf->b_namedm[i - 'a'].lnum = 0; | |
850 else | |
851 { | |
852 if (digit) | |
853 n = i - '0' + NMARKS; | |
854 else | |
855 n = i - 'A'; | |
856 namedfm[n].fmark.mark.lnum = 0; | |
857 vim_free(namedfm[n].fname); | |
858 namedfm[n].fname = NULL; | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
859 #ifdef FEAT_VIMINFO |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
860 namedfm[n].time_set = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
861 #endif |
24 | 862 } |
863 } | |
864 } | |
865 else | |
866 switch (*p) | |
867 { | |
868 case '"': curbuf->b_last_cursor.lnum = 0; break; | |
869 case '^': curbuf->b_last_insert.lnum = 0; break; | |
870 case '.': curbuf->b_last_change.lnum = 0; break; | |
871 case '[': curbuf->b_op_start.lnum = 0; break; | |
872 case ']': curbuf->b_op_end.lnum = 0; break; | |
690 | 873 case '<': curbuf->b_visual.vi_start.lnum = 0; break; |
874 case '>': curbuf->b_visual.vi_end.lnum = 0; break; | |
24 | 875 case ' ': break; |
876 default: EMSG2(_(e_invarg2), p); | |
877 return; | |
878 } | |
879 } | |
880 } | |
881 } | |
882 | |
7 | 883 #if defined(FEAT_JUMPLIST) || defined(PROTO) |
884 /* | |
885 * print the jumplist | |
886 */ | |
887 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
888 ex_jumps(exarg_T *eap UNUSED) |
7 | 889 { |
890 int i; | |
891 char_u *name; | |
892 | |
893 cleanup_jumplist(); | |
894 /* Highlight title */ | |
895 MSG_PUTS_TITLE(_("\n jump line col file/text")); | |
896 for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) | |
897 { | |
898 if (curwin->w_jumplist[i].fmark.mark.lnum != 0) | |
899 { | |
900 if (curwin->w_jumplist[i].fmark.fnum == 0) | |
901 fname2fnum(&curwin->w_jumplist[i]); | |
902 name = fm_getname(&curwin->w_jumplist[i].fmark, 16); | |
903 if (name == NULL) /* file name not available */ | |
904 continue; | |
905 | |
906 msg_putchar('\n'); | |
907 if (got_int) | |
1702 | 908 { |
909 vim_free(name); | |
7 | 910 break; |
1702 | 911 } |
7 | 912 sprintf((char *)IObuff, "%c %2d %5ld %4d ", |
913 i == curwin->w_jumplistidx ? '>' : ' ', | |
914 i > curwin->w_jumplistidx ? i - curwin->w_jumplistidx | |
915 : curwin->w_jumplistidx - i, | |
916 curwin->w_jumplist[i].fmark.mark.lnum, | |
917 curwin->w_jumplist[i].fmark.mark.col); | |
918 msg_outtrans(IObuff); | |
919 msg_outtrans_attr(name, | |
920 curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum | |
921 ? hl_attr(HLF_D) : 0); | |
922 vim_free(name); | |
923 ui_breakcheck(); | |
924 } | |
925 out_flush(); | |
926 } | |
927 if (curwin->w_jumplistidx == curwin->w_jumplistlen) | |
928 MSG_PUTS("\n>"); | |
929 } | |
930 | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
931 void |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
932 ex_clearjumps(exarg_T *eap UNUSED) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
933 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
934 free_jumplist(curwin); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
935 curwin->w_jumplistlen = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
936 curwin->w_jumplistidx = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
937 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
938 |
7 | 939 /* |
940 * print the changelist | |
941 */ | |
942 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
943 ex_changes(exarg_T *eap UNUSED) |
7 | 944 { |
945 int i; | |
946 char_u *name; | |
947 | |
948 /* Highlight title */ | |
949 MSG_PUTS_TITLE(_("\nchange line col text")); | |
950 | |
951 for (i = 0; i < curbuf->b_changelistlen && !got_int; ++i) | |
952 { | |
953 if (curbuf->b_changelist[i].lnum != 0) | |
954 { | |
955 msg_putchar('\n'); | |
956 if (got_int) | |
957 break; | |
958 sprintf((char *)IObuff, "%c %3d %5ld %4d ", | |
959 i == curwin->w_changelistidx ? '>' : ' ', | |
960 i > curwin->w_changelistidx ? i - curwin->w_changelistidx | |
961 : curwin->w_changelistidx - i, | |
962 (long)curbuf->b_changelist[i].lnum, | |
963 curbuf->b_changelist[i].col); | |
964 msg_outtrans(IObuff); | |
965 name = mark_line(&curbuf->b_changelist[i], 17); | |
966 if (name == NULL) | |
967 break; | |
968 msg_outtrans_attr(name, hl_attr(HLF_D)); | |
969 vim_free(name); | |
970 ui_breakcheck(); | |
971 } | |
972 out_flush(); | |
973 } | |
974 if (curwin->w_changelistidx == curbuf->b_changelistlen) | |
975 MSG_PUTS("\n>"); | |
976 } | |
977 #endif | |
978 | |
979 #define one_adjust(add) \ | |
980 { \ | |
981 lp = add; \ | |
982 if (*lp >= line1 && *lp <= line2) \ | |
983 { \ | |
984 if (amount == MAXLNUM) \ | |
985 *lp = 0; \ | |
986 else \ | |
987 *lp += amount; \ | |
988 } \ | |
989 else if (amount_after && *lp > line2) \ | |
990 *lp += amount_after; \ | |
991 } | |
992 | |
993 /* don't delete the line, just put at first deleted line */ | |
994 #define one_adjust_nodel(add) \ | |
995 { \ | |
996 lp = add; \ | |
997 if (*lp >= line1 && *lp <= line2) \ | |
998 { \ | |
999 if (amount == MAXLNUM) \ | |
1000 *lp = line1; \ | |
1001 else \ | |
1002 *lp += amount; \ | |
1003 } \ | |
1004 else if (amount_after && *lp > line2) \ | |
1005 *lp += amount_after; \ | |
1006 } | |
1007 | |
1008 /* | |
1009 * Adjust marks between line1 and line2 (inclusive) to move 'amount' lines. | |
1010 * Must be called before changed_*(), appended_lines() or deleted_lines(). | |
1011 * May be called before or after changing the text. | |
1012 * When deleting lines line1 to line2, use an 'amount' of MAXLNUM: The marks | |
1013 * within this range are made invalid. | |
1014 * If 'amount_after' is non-zero adjust marks after line2. | |
1015 * Example: Delete lines 34 and 35: mark_adjust(34, 35, MAXLNUM, -2); | |
1016 * Example: Insert two lines below 55: mark_adjust(56, MAXLNUM, 2, 0); | |
1017 * or: mark_adjust(56, 55, MAXLNUM, 2); | |
1018 */ | |
1019 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1020 mark_adjust( |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1021 linenr_T line1, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1022 linenr_T line2, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1023 long amount, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1024 long amount_after) |
7 | 1025 { |
1026 int i; | |
1027 int fnum = curbuf->b_fnum; | |
1028 linenr_T *lp; | |
1029 win_T *win; | |
1863 | 1030 #ifdef FEAT_WINDOWS |
1031 tabpage_T *tab; | |
1032 #endif | |
4092 | 1033 static pos_T initpos = INIT_POS_T(1, 0, 0); |
7 | 1034 |
1035 if (line2 < line1 && amount_after == 0L) /* nothing to do */ | |
1036 return; | |
1037 | |
1038 if (!cmdmod.lockmarks) | |
1039 { | |
1040 /* named marks, lower case and upper case */ | |
1041 for (i = 0; i < NMARKS; i++) | |
1042 { | |
1043 one_adjust(&(curbuf->b_namedm[i].lnum)); | |
1044 if (namedfm[i].fmark.fnum == fnum) | |
1045 one_adjust_nodel(&(namedfm[i].fmark.mark.lnum)); | |
1046 } | |
1047 for (i = NMARKS; i < NMARKS + EXTRA_MARKS; i++) | |
1048 { | |
1049 if (namedfm[i].fmark.fnum == fnum) | |
1050 one_adjust_nodel(&(namedfm[i].fmark.mark.lnum)); | |
1051 } | |
1052 | |
1053 /* last Insert position */ | |
1054 one_adjust(&(curbuf->b_last_insert.lnum)); | |
1055 | |
1056 /* last change position */ | |
1057 one_adjust(&(curbuf->b_last_change.lnum)); | |
1058 | |
4092 | 1059 /* last cursor position, if it was set */ |
1060 if (!equalpos(curbuf->b_last_cursor, initpos)) | |
1061 one_adjust(&(curbuf->b_last_cursor.lnum)); | |
1062 | |
1063 | |
7 | 1064 #ifdef FEAT_JUMPLIST |
1065 /* list of change positions */ | |
1066 for (i = 0; i < curbuf->b_changelistlen; ++i) | |
1067 one_adjust_nodel(&(curbuf->b_changelist[i].lnum)); | |
1068 #endif | |
1069 | |
1070 /* Visual area */ | |
690 | 1071 one_adjust_nodel(&(curbuf->b_visual.vi_start.lnum)); |
1072 one_adjust_nodel(&(curbuf->b_visual.vi_end.lnum)); | |
7 | 1073 |
1074 #ifdef FEAT_QUICKFIX | |
1075 /* quickfix marks */ | |
643 | 1076 qf_mark_adjust(NULL, line1, line2, amount, amount_after); |
1077 /* location lists */ | |
1863 | 1078 FOR_ALL_TAB_WINDOWS(tab, win) |
643 | 1079 qf_mark_adjust(win, line1, line2, amount, amount_after); |
7 | 1080 #endif |
1081 | |
1082 #ifdef FEAT_SIGNS | |
1083 sign_mark_adjust(line1, line2, amount, amount_after); | |
1084 #endif | |
1085 } | |
1086 | |
1087 /* previous context mark */ | |
1088 one_adjust(&(curwin->w_pcmark.lnum)); | |
1089 | |
1090 /* previous pcmark */ | |
1091 one_adjust(&(curwin->w_prev_pcmark.lnum)); | |
1092 | |
1093 /* saved cursor for formatting */ | |
1094 if (saved_cursor.lnum != 0) | |
1095 one_adjust_nodel(&(saved_cursor.lnum)); | |
1096 | |
1097 /* | |
1098 * Adjust items in all windows related to the current buffer. | |
1099 */ | |
1863 | 1100 FOR_ALL_TAB_WINDOWS(tab, win) |
7 | 1101 { |
1102 #ifdef FEAT_JUMPLIST | |
1103 if (!cmdmod.lockmarks) | |
1104 /* Marks in the jumplist. When deleting lines, this may create | |
1105 * duplicate marks in the jumplist, they will be removed later. */ | |
1106 for (i = 0; i < win->w_jumplistlen; ++i) | |
1107 if (win->w_jumplist[i].fmark.fnum == fnum) | |
1108 one_adjust_nodel(&(win->w_jumplist[i].fmark.mark.lnum)); | |
1109 #endif | |
1110 | |
1111 if (win->w_buffer == curbuf) | |
1112 { | |
1113 if (!cmdmod.lockmarks) | |
1114 /* marks in the tag stack */ | |
1115 for (i = 0; i < win->w_tagstacklen; i++) | |
1116 if (win->w_tagstack[i].fmark.fnum == fnum) | |
1117 one_adjust_nodel(&(win->w_tagstack[i].fmark.mark.lnum)); | |
1118 | |
1119 /* the displayed Visual area */ | |
1120 if (win->w_old_cursor_lnum != 0) | |
1121 { | |
1122 one_adjust_nodel(&(win->w_old_cursor_lnum)); | |
1123 one_adjust_nodel(&(win->w_old_visual_lnum)); | |
1124 } | |
1125 | |
1126 /* topline and cursor position for windows with the same buffer | |
1127 * other than the current window */ | |
1128 if (win != curwin) | |
1129 { | |
1130 if (win->w_topline >= line1 && win->w_topline <= line2) | |
1131 { | |
1132 if (amount == MAXLNUM) /* topline is deleted */ | |
1133 { | |
1134 if (line1 <= 1) | |
1135 win->w_topline = 1; | |
1136 else | |
1137 win->w_topline = line1 - 1; | |
1138 } | |
1139 else /* keep topline on the same line */ | |
1140 win->w_topline += amount; | |
1141 #ifdef FEAT_DIFF | |
1142 win->w_topfill = 0; | |
1143 #endif | |
1144 } | |
1145 else if (amount_after && win->w_topline > line2) | |
1146 { | |
1147 win->w_topline += amount_after; | |
1148 #ifdef FEAT_DIFF | |
1149 win->w_topfill = 0; | |
1150 #endif | |
1151 } | |
1152 if (win->w_cursor.lnum >= line1 && win->w_cursor.lnum <= line2) | |
1153 { | |
1154 if (amount == MAXLNUM) /* line with cursor is deleted */ | |
1155 { | |
1156 if (line1 <= 1) | |
1157 win->w_cursor.lnum = 1; | |
1158 else | |
1159 win->w_cursor.lnum = line1 - 1; | |
1160 win->w_cursor.col = 0; | |
1161 } | |
1162 else /* keep cursor on the same line */ | |
1163 win->w_cursor.lnum += amount; | |
1164 } | |
1165 else if (amount_after && win->w_cursor.lnum > line2) | |
1166 win->w_cursor.lnum += amount_after; | |
1167 } | |
1168 | |
1169 #ifdef FEAT_FOLDING | |
1170 /* adjust folds */ | |
1171 foldMarkAdjust(win, line1, line2, amount, amount_after); | |
1172 #endif | |
1173 } | |
1174 } | |
1175 | |
1176 #ifdef FEAT_DIFF | |
1177 /* adjust diffs */ | |
1178 diff_mark_adjust(line1, line2, amount, amount_after); | |
1179 #endif | |
1180 } | |
1181 | |
1182 /* This code is used often, needs to be fast. */ | |
1183 #define col_adjust(pp) \ | |
1184 { \ | |
1185 posp = pp; \ | |
1186 if (posp->lnum == lnum && posp->col >= mincol) \ | |
1187 { \ | |
1188 posp->lnum += lnum_amount; \ | |
1189 if (col_amount < 0 && posp->col <= (colnr_T)-col_amount) \ | |
1190 posp->col = 0; \ | |
1191 else \ | |
1192 posp->col += col_amount; \ | |
1193 } \ | |
1194 } | |
1195 | |
1196 /* | |
1197 * Adjust marks in line "lnum" at column "mincol" and further: add | |
1198 * "lnum_amount" to the line number and add "col_amount" to the column | |
1199 * position. | |
1200 */ | |
1201 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1202 mark_col_adjust( |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1203 linenr_T lnum, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1204 colnr_T mincol, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1205 long lnum_amount, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1206 long col_amount) |
7 | 1207 { |
1208 int i; | |
1209 int fnum = curbuf->b_fnum; | |
1210 win_T *win; | |
1211 pos_T *posp; | |
1212 | |
1213 if ((col_amount == 0L && lnum_amount == 0L) || cmdmod.lockmarks) | |
1214 return; /* nothing to do */ | |
1215 | |
1216 /* named marks, lower case and upper case */ | |
1217 for (i = 0; i < NMARKS; i++) | |
1218 { | |
1219 col_adjust(&(curbuf->b_namedm[i])); | |
1220 if (namedfm[i].fmark.fnum == fnum) | |
1221 col_adjust(&(namedfm[i].fmark.mark)); | |
1222 } | |
1223 for (i = NMARKS; i < NMARKS + EXTRA_MARKS; i++) | |
1224 { | |
1225 if (namedfm[i].fmark.fnum == fnum) | |
1226 col_adjust(&(namedfm[i].fmark.mark)); | |
1227 } | |
1228 | |
1229 /* last Insert position */ | |
1230 col_adjust(&(curbuf->b_last_insert)); | |
1231 | |
1232 /* last change position */ | |
1233 col_adjust(&(curbuf->b_last_change)); | |
1234 | |
1235 #ifdef FEAT_JUMPLIST | |
1236 /* list of change positions */ | |
1237 for (i = 0; i < curbuf->b_changelistlen; ++i) | |
1238 col_adjust(&(curbuf->b_changelist[i])); | |
1239 #endif | |
1240 | |
1241 /* Visual area */ | |
690 | 1242 col_adjust(&(curbuf->b_visual.vi_start)); |
1243 col_adjust(&(curbuf->b_visual.vi_end)); | |
7 | 1244 |
1245 /* previous context mark */ | |
1246 col_adjust(&(curwin->w_pcmark)); | |
1247 | |
1248 /* previous pcmark */ | |
1249 col_adjust(&(curwin->w_prev_pcmark)); | |
1250 | |
1251 /* saved cursor for formatting */ | |
1252 col_adjust(&saved_cursor); | |
1253 | |
1254 /* | |
1255 * Adjust items in all windows related to the current buffer. | |
1256 */ | |
1257 FOR_ALL_WINDOWS(win) | |
1258 { | |
1259 #ifdef FEAT_JUMPLIST | |
1260 /* marks in the jumplist */ | |
1261 for (i = 0; i < win->w_jumplistlen; ++i) | |
1262 if (win->w_jumplist[i].fmark.fnum == fnum) | |
1263 col_adjust(&(win->w_jumplist[i].fmark.mark)); | |
1264 #endif | |
1265 | |
1266 if (win->w_buffer == curbuf) | |
1267 { | |
1268 /* marks in the tag stack */ | |
1269 for (i = 0; i < win->w_tagstacklen; i++) | |
1270 if (win->w_tagstack[i].fmark.fnum == fnum) | |
1271 col_adjust(&(win->w_tagstack[i].fmark.mark)); | |
1272 | |
1273 /* cursor position for other windows with the same buffer */ | |
1274 if (win != curwin) | |
1275 col_adjust(&win->w_cursor); | |
1276 } | |
1277 } | |
1278 } | |
1279 | |
1280 #ifdef FEAT_JUMPLIST | |
1281 /* | |
1282 * When deleting lines, this may create duplicate marks in the | |
1283 * jumplist. They will be removed here for the current window. | |
1284 */ | |
1285 static void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1286 cleanup_jumplist(void) |
7 | 1287 { |
1288 int i; | |
1289 int from, to; | |
1290 | |
1291 to = 0; | |
1292 for (from = 0; from < curwin->w_jumplistlen; ++from) | |
1293 { | |
1294 if (curwin->w_jumplistidx == from) | |
1295 curwin->w_jumplistidx = to; | |
1296 for (i = from + 1; i < curwin->w_jumplistlen; ++i) | |
1297 if (curwin->w_jumplist[i].fmark.fnum | |
1298 == curwin->w_jumplist[from].fmark.fnum | |
1299 && curwin->w_jumplist[from].fmark.fnum != 0 | |
1300 && curwin->w_jumplist[i].fmark.mark.lnum | |
1301 == curwin->w_jumplist[from].fmark.mark.lnum) | |
1302 break; | |
1303 if (i >= curwin->w_jumplistlen) /* no duplicate */ | |
1304 curwin->w_jumplist[to++] = curwin->w_jumplist[from]; | |
1305 else | |
1306 vim_free(curwin->w_jumplist[from].fname); | |
1307 } | |
1308 if (curwin->w_jumplistidx == curwin->w_jumplistlen) | |
1309 curwin->w_jumplistidx = to; | |
1310 curwin->w_jumplistlen = to; | |
1311 } | |
1312 | |
1313 # if defined(FEAT_WINDOWS) || defined(PROTO) | |
1314 /* | |
1315 * Copy the jumplist from window "from" to window "to". | |
1316 */ | |
1317 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1318 copy_jumplist(win_T *from, win_T *to) |
7 | 1319 { |
1320 int i; | |
1321 | |
1322 for (i = 0; i < from->w_jumplistlen; ++i) | |
1323 { | |
1324 to->w_jumplist[i] = from->w_jumplist[i]; | |
1325 if (from->w_jumplist[i].fname != NULL) | |
1326 to->w_jumplist[i].fname = vim_strsave(from->w_jumplist[i].fname); | |
1327 } | |
1328 to->w_jumplistlen = from->w_jumplistlen; | |
1329 to->w_jumplistidx = from->w_jumplistidx; | |
1330 } | |
1331 | |
1332 /* | |
1333 * Free items in the jumplist of window "wp". | |
1334 */ | |
1335 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1336 free_jumplist(win_T *wp) |
7 | 1337 { |
1338 int i; | |
1339 | |
1340 for (i = 0; i < wp->w_jumplistlen; ++i) | |
1341 vim_free(wp->w_jumplist[i].fname); | |
1342 } | |
1343 # endif | |
1344 #endif /* FEAT_JUMPLIST */ | |
1345 | |
1346 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1347 set_last_cursor(win_T *win) |
7 | 1348 { |
5417 | 1349 if (win->w_buffer != NULL) |
1350 win->w_buffer->b_last_cursor = win->w_cursor; | |
7 | 1351 } |
1352 | |
358 | 1353 #if defined(EXITFREE) || defined(PROTO) |
1354 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1355 free_all_marks(void) |
358 | 1356 { |
1357 int i; | |
1358 | |
1359 for (i = 0; i < NMARKS + EXTRA_MARKS; i++) | |
1360 if (namedfm[i].fmark.mark.lnum != 0) | |
1361 vim_free(namedfm[i].fname); | |
1362 } | |
1363 #endif | |
1364 | |
7 | 1365 #if defined(FEAT_VIMINFO) || defined(PROTO) |
1366 int | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1367 read_viminfo_filemark(vir_T *virp, int force) |
7 | 1368 { |
1369 char_u *str; | |
1370 xfmark_T *fm; | |
1371 int i; | |
1372 | |
1373 /* We only get here if line[0] == '\'' or '-'. | |
1374 * Illegal mark names are ignored (for future expansion). */ | |
1375 str = virp->vir_line + 1; | |
1376 if ( | |
1377 #ifndef EBCDIC | |
1378 *str <= 127 && | |
1379 #endif | |
1380 ((*virp->vir_line == '\'' && (VIM_ISDIGIT(*str) || isupper(*str))) | |
1381 || (*virp->vir_line == '-' && *str == '\''))) | |
1382 { | |
1383 if (*str == '\'') | |
1384 { | |
1385 #ifdef FEAT_JUMPLIST | |
1386 /* If the jumplist isn't full insert fmark as oldest entry */ | |
1387 if (curwin->w_jumplistlen == JUMPLISTSIZE) | |
1388 fm = NULL; | |
1389 else | |
1390 { | |
1391 for (i = curwin->w_jumplistlen; i > 0; --i) | |
1392 curwin->w_jumplist[i] = curwin->w_jumplist[i - 1]; | |
1393 ++curwin->w_jumplistidx; | |
1394 ++curwin->w_jumplistlen; | |
1395 fm = &curwin->w_jumplist[0]; | |
1396 fm->fmark.mark.lnum = 0; | |
1397 fm->fname = NULL; | |
1398 } | |
1399 #else | |
1400 fm = NULL; | |
1401 #endif | |
1402 } | |
1403 else if (VIM_ISDIGIT(*str)) | |
1404 fm = &namedfm[*str - '0' + NMARKS]; | |
1405 else | |
1406 fm = &namedfm[*str - 'A']; | |
1407 if (fm != NULL && (fm->fmark.mark.lnum == 0 || force)) | |
1408 { | |
1409 str = skipwhite(str + 1); | |
1410 fm->fmark.mark.lnum = getdigits(&str); | |
1411 str = skipwhite(str); | |
1412 fm->fmark.mark.col = getdigits(&str); | |
1413 #ifdef FEAT_VIRTUALEDIT | |
1414 fm->fmark.mark.coladd = 0; | |
1415 #endif | |
1416 fm->fmark.fnum = 0; | |
1417 str = skipwhite(str); | |
1418 vim_free(fm->fname); | |
1419 fm->fname = viminfo_readstring(virp, (int)(str - virp->vir_line), | |
1420 FALSE); | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1421 fm->time_set = 0; |
7 | 1422 } |
1423 } | |
1424 return vim_fgets(virp->vir_line, LSIZE, virp->vir_fd); | |
1425 } | |
1426 | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1427 static xfmark_T *vi_namedfm = NULL; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1428 #ifdef FEAT_JUMPLIST |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1429 static xfmark_T *vi_jumplist = NULL; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1430 static int vi_jumplist_len = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1431 #endif |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1432 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1433 /* |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1434 * Prepare for reading viminfo marks when writing viminfo later. |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1435 */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1436 void |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1437 prepare_viminfo_marks(void) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1438 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1439 vi_namedfm = (xfmark_T *)alloc_clear((NMARKS + EXTRA_MARKS) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1440 * (int)sizeof(xfmark_T)); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1441 #ifdef FEAT_JUMPLIST |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1442 vi_jumplist = (xfmark_T *)alloc_clear(JUMPLISTSIZE |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1443 * (int)sizeof(xfmark_T)); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1444 vi_jumplist_len = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1445 #endif |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1446 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1447 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1448 void |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1449 finish_viminfo_marks(void) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1450 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1451 int i; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1452 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1453 if (vi_namedfm != NULL) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1454 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1455 for (i = 0; i < NMARKS + EXTRA_MARKS; ++i) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1456 vim_free(vi_namedfm[i].fname); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1457 vim_free(vi_namedfm); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1458 vi_namedfm = NULL; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1459 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1460 #ifdef FEAT_JUMPLIST |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1461 if (vi_jumplist != NULL) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1462 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1463 for (i = 0; i < vi_jumplist_len; ++i) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1464 vim_free(vi_jumplist[i].fname); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1465 vim_free(vi_jumplist); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1466 vi_jumplist = NULL; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1467 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1468 #endif |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1469 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1470 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1471 /* |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1472 * Accept a new style mark line from the viminfo, store it when it's new. |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1473 */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1474 void |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1475 handle_viminfo_mark(garray_T *values, int force) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1476 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1477 bval_T *vp = (bval_T *)values->ga_data; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1478 int name; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1479 linenr_T lnum; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1480 colnr_T col; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1481 time_t timestamp; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1482 xfmark_T *fm = NULL; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1483 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1484 /* Check the format: |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1485 * |{bartype},{name},{lnum},{col},{timestamp},{filename} */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1486 if (values->ga_len < 5 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1487 || vp[0].bv_type != BVAL_NR |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1488 || vp[1].bv_type != BVAL_NR |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1489 || vp[2].bv_type != BVAL_NR |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1490 || vp[3].bv_type != BVAL_NR |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1491 || vp[4].bv_type != BVAL_STRING) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1492 return; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1493 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1494 name = vp[0].bv_nr; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1495 if (name != '\'' && !VIM_ISDIGIT(name) && !ASCII_ISUPPER(name)) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1496 return; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1497 lnum = vp[1].bv_nr; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1498 col = vp[2].bv_nr; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1499 if (lnum <= 0 || col < 0) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1500 return; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1501 timestamp = (time_t)vp[3].bv_nr; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1502 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1503 if (name == '\'') |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1504 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1505 #ifdef FEAT_JUMPLIST |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1506 if (vi_jumplist != NULL) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1507 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1508 if (vi_jumplist_len < JUMPLISTSIZE) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1509 fm = &vi_jumplist[vi_jumplist_len++]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1510 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1511 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1512 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1513 int idx; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1514 int i; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1515 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1516 /* If we have a timestamp insert it in the right place. */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1517 if (timestamp != 0) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1518 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1519 for (idx = curwin->w_jumplistlen - 1; idx >= 0; --idx) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1520 if (curwin->w_jumplist[idx].time_set < timestamp) |
9299
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1521 { |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1522 ++idx; |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1523 break; |
9299
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1524 } |
9322
f2e534fdbe65
commit https://github.com/vim/vim/commit/678e480529bce7ba3c09e71233249e3b56531b24
Christian Brabandt <cb@256bit.org>
parents:
9313
diff
changeset
|
1525 /* idx cannot be zero now */ |
9299
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1526 if (idx < 0 && curwin->w_jumplistlen < JUMPLISTSIZE) |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1527 /* insert as the oldest entry */ |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1528 idx = 0; |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1529 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1530 else if (curwin->w_jumplistlen < JUMPLISTSIZE) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1531 /* insert as oldest entry */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1532 idx = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1533 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1534 idx = -1; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1535 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1536 if (idx >= 0) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1537 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1538 if (curwin->w_jumplistlen == JUMPLISTSIZE) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1539 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1540 /* Drop the oldest entry. */ |
9313
c0760b25f31d
commit https://github.com/vim/vim/commit/28607ba2b82668503f8406bc13690d59af46deb3
Christian Brabandt <cb@256bit.org>
parents:
9311
diff
changeset
|
1541 --idx; |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1542 vim_free(curwin->w_jumplist[0].fname); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1543 for (i = 0; i < idx; ++i) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1544 curwin->w_jumplist[i] = curwin->w_jumplist[i + 1]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1545 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1546 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1547 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1548 /* Move newer entries forward. */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1549 for (i = curwin->w_jumplistlen; i > idx; --i) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1550 curwin->w_jumplist[i] = curwin->w_jumplist[i - 1]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1551 ++curwin->w_jumplistidx; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1552 ++curwin->w_jumplistlen; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1553 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1554 fm = &curwin->w_jumplist[idx]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1555 fm->fmark.mark.lnum = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1556 fm->fname = NULL; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1557 fm->time_set = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1558 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1559 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1560 #endif |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1561 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1562 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1563 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1564 int idx; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1565 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1566 if (VIM_ISDIGIT(name)) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1567 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1568 if (vi_namedfm != NULL) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1569 idx = name - '0' + NMARKS; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1570 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1571 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1572 int i; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1573 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1574 /* Do not use the name from the viminfo file, insert in time |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1575 * order. */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1576 for (idx = NMARKS; idx < NMARKS + EXTRA_MARKS; ++idx) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1577 if (namedfm[idx].time_set < timestamp) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1578 break; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1579 if (idx == NMARKS + EXTRA_MARKS) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1580 /* All existing entries are newer. */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1581 return; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1582 i = NMARKS + EXTRA_MARKS - 1; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1583 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1584 vim_free(namedfm[i].fname); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1585 for ( ; i > idx; --i) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1586 namedfm[i] = namedfm[i - 1]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1587 namedfm[idx].fname = NULL; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1588 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1589 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1590 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1591 idx = name - 'A'; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1592 if (vi_namedfm != NULL) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1593 fm = &vi_namedfm[idx]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1594 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1595 fm = &namedfm[idx]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1596 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1597 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1598 if (fm != NULL) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1599 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1600 if (vi_namedfm != NULL || fm->time_set < timestamp || force) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1601 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1602 fm->fmark.mark.lnum = lnum; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1603 fm->fmark.mark.col = col; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1604 #ifdef FEAT_VIRTUALEDIT |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1605 fm->fmark.mark.coladd = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1606 #endif |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1607 fm->fmark.fnum = 0; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1608 vim_free(fm->fname); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1609 if (vp[4].bv_allocated) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1610 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1611 fm->fname = vp[4].bv_string; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1612 vp[4].bv_string = NULL; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1613 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1614 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1615 fm->fname = vim_strsave(vp[4].bv_string); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1616 fm->time_set = timestamp; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1617 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1618 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1619 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1620 |
7 | 1621 void |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1622 write_viminfo_filemarks(FILE *fp) |
7 | 1623 { |
1624 int i; | |
1625 char_u *name; | |
1626 buf_T *buf; | |
1627 xfmark_T *fm; | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1628 int vi_idx; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1629 int idx; |
7 | 1630 |
1631 if (get_viminfo_parameter('f') == 0) | |
1632 return; | |
1633 | |
2545
298d8d6e69be
Avoid warnings from the clang compiler. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
1880
diff
changeset
|
1634 fputs(_("\n# File marks:\n"), fp); |
7 | 1635 |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1636 /* Write the filemarks 'A - 'Z */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1637 for (i = 0; i < NMARKS; i++) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1638 { |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1639 if (vi_namedfm != NULL && (vi_namedfm[i].time_set > namedfm[i].time_set |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1640 || namedfm[i].fmark.mark.lnum == 0)) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1641 fm = &vi_namedfm[i]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1642 else |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1643 fm = &namedfm[i]; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1644 write_one_filemark(fp, fm, '\'', i + 'A'); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1645 } |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1646 |
7 | 1647 /* |
1648 * Find a mark that is the same file and position as the cursor. | |
1649 * That one, or else the last one is deleted. | |
1650 * Move '0 to '1, '1 to '2, etc. until the matching one or '9 | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1651 * Set the '0 mark to current cursor position. |
7 | 1652 */ |
1653 if (curbuf->b_ffname != NULL && !removable(curbuf->b_ffname)) | |
1654 { | |
1655 name = buflist_nr2name(curbuf->b_fnum, TRUE, FALSE); | |
1656 for (i = NMARKS; i < NMARKS + EXTRA_MARKS - 1; ++i) | |
1657 if (namedfm[i].fmark.mark.lnum == curwin->w_cursor.lnum | |
1658 && (namedfm[i].fname == NULL | |
1659 ? namedfm[i].fmark.fnum == curbuf->b_fnum | |
1660 : (name != NULL | |
1661 && STRCMP(name, namedfm[i].fname) == 0))) | |
1662 break; | |
1663 vim_free(name); | |
1664 | |
1665 vim_free(namedfm[i].fname); | |
1666 for ( ; i > NMARKS; --i) | |
1667 namedfm[i] = namedfm[i - 1]; | |
1668 namedfm[NMARKS].fmark.mark = curwin->w_cursor; | |
1669 namedfm[NMARKS].fmark.fnum = curbuf->b_fnum; | |
1670 namedfm[NMARKS].fname = NULL; | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1671 namedfm[NMARKS].time_set = vim_time(); |
7 | 1672 } |
1673 | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1674 /* Write the filemarks '0 - '9. Newest (highest timestamp) first. */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1675 vi_idx = NMARKS; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1676 idx = NMARKS; |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1677 for (i = NMARKS; i < NMARKS + EXTRA_MARKS; i++) |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1678 { |
9311
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1679 xfmark_T *vi_fm = vi_namedfm != NULL ? &vi_namedfm[vi_idx] : NULL; |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1680 |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1681 if (vi_fm != NULL |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1682 && vi_fm->fmark.mark.lnum != 0 |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1683 && (vi_fm->time_set > namedfm[idx].time_set |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1684 || namedfm[idx].fmark.mark.lnum == 0)) |
9311
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1685 { |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1686 fm = vi_fm; |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1687 ++vi_idx; |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1688 } |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1689 else |
9311
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1690 { |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1691 fm = &namedfm[idx++]; |
9311
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1692 if (vi_fm != NULL |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1693 && vi_fm->fmark.mark.lnum == fm->fmark.mark.lnum |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1694 && vi_fm->time_set == fm->time_set |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1695 && ((vi_fm->fmark.fnum != 0 |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1696 && vi_fm->fmark.fnum == fm->fmark.fnum) |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1697 || (vi_fm->fname != NULL |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1698 && fm->fname != NULL |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1699 && STRCMP(vi_fm->fname, fm->fname) == 0))) |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1700 ++vi_idx; /* skip duplicate */ |
7a6f64de57d5
commit https://github.com/vim/vim/commit/36f0f0686ca313ef7b76387378cd5dc7acea1924
Christian Brabandt <cb@256bit.org>
parents:
9299
diff
changeset
|
1701 } |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1702 write_one_filemark(fp, fm, '\'', i - NMARKS + '0'); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1703 } |
7 | 1704 |
1705 #ifdef FEAT_JUMPLIST | |
1706 /* Write the jumplist with -' */ | |
2545
298d8d6e69be
Avoid warnings from the clang compiler. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
1880
diff
changeset
|
1707 fputs(_("\n# Jumplist (newest first):\n"), fp); |
7 | 1708 setpcmark(); /* add current cursor position */ |
1709 cleanup_jumplist(); | |
9299
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1710 vi_idx = 0; |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1711 idx = curwin->w_jumplistlen - 1; |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1712 for (i = 0; i < JUMPLISTSIZE; ++i) |
7 | 1713 { |
9299
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1714 xfmark_T *vi_fm; |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1715 |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1716 fm = idx >= 0 ? &curwin->w_jumplist[idx] : NULL; |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1717 vi_fm = vi_idx < vi_jumplist_len ? &vi_jumplist[vi_idx] : NULL; |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1718 if (fm == NULL && vi_fm == NULL) |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1719 break; |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1720 if (fm == NULL || (vi_fm != NULL && fm->time_set < vi_fm->time_set)) |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1721 { |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1722 fm = vi_fm; |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1723 ++vi_idx; |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1724 } |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1725 else |
8000f0a44744
commit https://github.com/vim/vim/commit/ece74ab103eca15e17435efbe9cb21039787f1ea
Christian Brabandt <cb@256bit.org>
parents:
9284
diff
changeset
|
1726 --idx; |
7 | 1727 if (fm->fmark.fnum == 0 |
1728 || ((buf = buflist_findnr(fm->fmark.fnum)) != NULL | |
1729 && !removable(buf->b_ffname))) | |
1730 write_one_filemark(fp, fm, '-', '\''); | |
1731 } | |
1732 #endif | |
1733 } | |
1734 | |
1735 static void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1736 write_one_filemark( |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1737 FILE *fp, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1738 xfmark_T *fm, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1739 int c1, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1740 int c2) |
7 | 1741 { |
1742 char_u *name; | |
1743 | |
1744 if (fm->fmark.mark.lnum == 0) /* not set */ | |
1745 return; | |
1746 | |
1747 if (fm->fmark.fnum != 0) /* there is a buffer */ | |
1748 name = buflist_nr2name(fm->fmark.fnum, TRUE, FALSE); | |
1749 else | |
1750 name = fm->fname; /* use name from .viminfo */ | |
1751 if (name != NULL && *name != NUL) | |
1752 { | |
1753 fprintf(fp, "%c%c %ld %ld ", c1, c2, (long)fm->fmark.mark.lnum, | |
1754 (long)fm->fmark.mark.col); | |
1755 viminfo_writestring(fp, name); | |
9284
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1756 |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1757 /* Barline: |{bartype},{name},{lnum},{col},{timestamp},{filename} |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1758 * size up to filename: 8 + 3 * 20 */ |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1759 fprintf(fp, "|%d,%d,%ld,%ld,%ld,", BARTYPE_MARK, c2, |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1760 (long)fm->fmark.mark.lnum, (long)fm->fmark.mark.col, |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1761 (long)fm->time_set); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1762 barline_writestring(fp, name, LSIZE - 70); |
78712a2f687a
commit https://github.com/vim/vim/commit/2d35899721da0e9359a9fe1059554f8c4ea7f0c1
Christian Brabandt <cb@256bit.org>
parents:
7827
diff
changeset
|
1763 putc('\n', fp); |
7 | 1764 } |
1765 | |
1766 if (fm->fmark.fnum != 0) | |
1767 vim_free(name); | |
1768 } | |
1769 | |
1770 /* | |
1771 * Return TRUE if "name" is on removable media (depending on 'viminfo'). | |
1772 */ | |
1773 int | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1774 removable(char_u *name) |
7 | 1775 { |
1776 char_u *p; | |
1777 char_u part[51]; | |
1778 int retval = FALSE; | |
307 | 1779 size_t n; |
7 | 1780 |
1781 name = home_replace_save(NULL, name); | |
1782 if (name != NULL) | |
1783 { | |
1784 for (p = p_viminfo; *p; ) | |
1785 { | |
1786 copy_option_part(&p, part, 51, ", "); | |
307 | 1787 if (part[0] == 'r') |
7 | 1788 { |
307 | 1789 n = STRLEN(part + 1); |
1790 if (MB_STRNICMP(part + 1, name, n) == 0) | |
1791 { | |
1792 retval = TRUE; | |
1793 break; | |
1794 } | |
7 | 1795 } |
1796 } | |
1797 vim_free(name); | |
1798 } | |
1799 return retval; | |
1800 } | |
1801 | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1802 static void |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1803 write_one_mark(FILE *fp_out, int c, pos_T *pos) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1804 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1805 if (pos->lnum != 0) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1806 fprintf(fp_out, "\t%c\t%ld\t%d\n", c, (long)pos->lnum, (int)pos->col); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1807 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1808 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1809 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1810 static void |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1811 write_buffer_marks(buf_T *buf, FILE *fp_out) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1812 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1813 int i; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1814 pos_T pos; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1815 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1816 home_replace(NULL, buf->b_ffname, IObuff, IOSIZE, TRUE); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1817 fprintf(fp_out, "\n> "); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1818 viminfo_writestring(fp_out, IObuff); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1819 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1820 /* Write the last used timestamp as the lnum of the non-existing mark '*'. |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1821 * Older Vims will ignore it and/or copy it. */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1822 pos.lnum = (linenr_T)buf->b_last_used; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1823 pos.col = 0; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1824 write_one_mark(fp_out, '*', &pos); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1825 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1826 write_one_mark(fp_out, '"', &buf->b_last_cursor); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1827 write_one_mark(fp_out, '^', &buf->b_last_insert); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1828 write_one_mark(fp_out, '.', &buf->b_last_change); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1829 #ifdef FEAT_JUMPLIST |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1830 /* changelist positions are stored oldest first */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1831 for (i = 0; i < buf->b_changelistlen; ++i) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1832 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1833 /* skip duplicates */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1834 if (i == 0 || !equalpos(buf->b_changelist[i - 1], buf->b_changelist[i])) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1835 write_one_mark(fp_out, '+', &buf->b_changelist[i]); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1836 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1837 #endif |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1838 for (i = 0; i < NMARKS; i++) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1839 write_one_mark(fp_out, 'a' + i, &buf->b_namedm[i]); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1840 } |
7 | 1841 |
1842 /* | |
1843 * Write all the named marks for all buffers. | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1844 * When "buflist" is not NULL fill it with the buffers for which marks are to |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1845 * be written. |
7 | 1846 */ |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1847 void |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1848 write_viminfo_marks(FILE *fp_out, garray_T *buflist) |
7 | 1849 { |
1850 buf_T *buf; | |
1851 int is_mark_set; | |
1852 int i; | |
1853 #ifdef FEAT_WINDOWS | |
1854 win_T *win; | |
671 | 1855 tabpage_T *tp; |
7 | 1856 |
1857 /* | |
1858 * Set b_last_cursor for the all buffers that have a window. | |
1859 */ | |
671 | 1860 FOR_ALL_TAB_WINDOWS(tp, win) |
7 | 1861 set_last_cursor(win); |
1862 #else | |
1863 set_last_cursor(curwin); | |
1864 #endif | |
1865 | |
2545
298d8d6e69be
Avoid warnings from the clang compiler. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents:
1880
diff
changeset
|
1866 fputs(_("\n# History of marks within files (newest to oldest):\n"), fp_out); |
9649
fd9727ae3c49
commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents:
9414
diff
changeset
|
1867 FOR_ALL_BUFFERS(buf) |
7 | 1868 { |
1869 /* | |
1870 * Only write something if buffer has been loaded and at least one | |
1871 * mark is set. | |
1872 */ | |
1873 if (buf->b_marks_read) | |
1874 { | |
1875 if (buf->b_last_cursor.lnum != 0) | |
1876 is_mark_set = TRUE; | |
1877 else | |
1878 { | |
1879 is_mark_set = FALSE; | |
1880 for (i = 0; i < NMARKS; i++) | |
1881 if (buf->b_namedm[i].lnum != 0) | |
1882 { | |
1883 is_mark_set = TRUE; | |
1884 break; | |
1885 } | |
1886 } | |
1887 if (is_mark_set && buf->b_ffname != NULL | |
1888 && buf->b_ffname[0] != NUL && !removable(buf->b_ffname)) | |
1889 { | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1890 if (buflist == NULL) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1891 write_buffer_marks(buf, fp_out); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1892 else if (ga_grow(buflist, 1) == OK) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1893 ((buf_T **)buflist->ga_data)[buflist->ga_len++] = buf; |
7 | 1894 } |
1895 } | |
1896 } | |
1897 } | |
1898 | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1899 /* |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1900 * Compare functions for qsort() below, that compares b_last_used. |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1901 */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1902 static int |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1903 #ifdef __BORLANDC__ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1904 _RTLENTRYF |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1905 #endif |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1906 buf_compare(const void *s1, const void *s2) |
7 | 1907 { |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1908 buf_T *buf1 = *(buf_T **)s1; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1909 buf_T *buf2 = *(buf_T **)s2; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1910 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1911 if (buf1->b_last_used == buf2->b_last_used) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1912 return 0; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1913 return buf1->b_last_used > buf2->b_last_used ? -1 : 1; |
7 | 1914 } |
1915 | |
1916 /* | |
1917 * Handle marks in the viminfo file: | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1918 * fp_out != NULL: copy marks, in time order with buffers in "buflist". |
1733 | 1919 * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only |
1920 * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles | |
7 | 1921 */ |
1922 void | |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1923 copy_viminfo_marks( |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1924 vir_T *virp, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1925 FILE *fp_out, |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1926 garray_T *buflist, |
7827
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1927 int eof, |
41789f16d6b2
commit https://github.com/vim/vim/commit/52ea13da0fe86df1abf34de52841e367035170c0
Christian Brabandt <cb@256bit.org>
parents:
7803
diff
changeset
|
1928 int flags) |
7 | 1929 { |
1930 char_u *line = virp->vir_line; | |
1931 buf_T *buf; | |
1932 int num_marked_files; | |
1933 int load_marks; | |
1934 int copy_marks_out; | |
1935 char_u *str; | |
1936 int i; | |
1937 char_u *p; | |
1938 char_u *name_buf; | |
1939 pos_T pos; | |
1733 | 1940 #ifdef FEAT_EVAL |
1941 list_T *list = NULL; | |
1942 #endif | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1943 int count = 0; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1944 int buflist_used = 0; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1945 buf_T *buflist_buf = NULL; |
7 | 1946 |
1947 if ((name_buf = alloc(LSIZE)) == NULL) | |
1948 return; | |
1949 *name_buf = NUL; | |
1733 | 1950 |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1951 if (fp_out != NULL && buflist->ga_len > 0) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1952 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1953 /* Sort the list of buffers on b_last_used. */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1954 qsort(buflist->ga_data, (size_t)buflist->ga_len, |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1955 sizeof(buf_T *), buf_compare); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1956 buflist_buf = ((buf_T **)buflist->ga_data)[0]; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1957 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
1958 |
1733 | 1959 #ifdef FEAT_EVAL |
1960 if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT))) | |
1961 { | |
1962 list = list_alloc(); | |
1963 if (list != NULL) | |
1964 set_vim_var_list(VV_OLDFILES, list); | |
1965 } | |
1966 #endif | |
1967 | |
7 | 1968 num_marked_files = get_viminfo_parameter('\''); |
1969 while (!eof && (count < num_marked_files || fp_out == NULL)) | |
1970 { | |
1971 if (line[0] != '>') | |
1972 { | |
1973 if (line[0] != '\n' && line[0] != '\r' && line[0] != '#') | |
1974 { | |
1975 if (viminfo_error("E576: ", _("Missing '>'"), line)) | |
1976 break; /* too many errors, return now */ | |
1977 } | |
1978 eof = vim_fgets(line, LSIZE, virp->vir_fd); | |
1979 continue; /* Skip this dud line */ | |
1980 } | |
1981 | |
1982 /* | |
1983 * Handle long line and translate escaped characters. | |
1984 * Find file name, set str to start. | |
1985 * Ignore leading and trailing white space. | |
1986 */ | |
1987 str = skipwhite(line + 1); | |
1988 str = viminfo_readstring(virp, (int)(str - virp->vir_line), FALSE); | |
1989 if (str == NULL) | |
1990 continue; | |
1991 p = str + STRLEN(str); | |
1992 while (p != str && (*p == NUL || vim_isspace(*p))) | |
1993 p--; | |
1994 if (*p) | |
1995 p++; | |
1996 *p = NUL; | |
1997 | |
1733 | 1998 #ifdef FEAT_EVAL |
1999 if (list != NULL) | |
2000 list_append_string(list, str, -1); | |
2001 #endif | |
2002 | |
7 | 2003 /* |
2004 * If fp_out == NULL, load marks for current buffer. | |
2005 * If fp_out != NULL, copy marks for buffers not in buflist. | |
2006 */ | |
2007 load_marks = copy_marks_out = FALSE; | |
2008 if (fp_out == NULL) | |
2009 { | |
1733 | 2010 if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL) |
7 | 2011 { |
2012 if (*name_buf == NUL) /* only need to do this once */ | |
2013 home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE); | |
2014 if (fnamecmp(str, name_buf) == 0) | |
2015 load_marks = TRUE; | |
2016 } | |
2017 } | |
2018 else /* fp_out != NULL */ | |
2019 { | |
2020 /* This is slow if there are many buffers!! */ | |
9649
fd9727ae3c49
commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents:
9414
diff
changeset
|
2021 FOR_ALL_BUFFERS(buf) |
7 | 2022 if (buf->b_ffname != NULL) |
2023 { | |
2024 home_replace(NULL, buf->b_ffname, name_buf, LSIZE, TRUE); | |
2025 if (fnamecmp(str, name_buf) == 0) | |
2026 break; | |
2027 } | |
2028 | |
2029 /* | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2030 * Copy marks if the buffer has not been loaded. |
7 | 2031 */ |
2032 if (buf == NULL || !buf->b_marks_read) | |
2033 { | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2034 int did_read_line = FALSE; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2035 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2036 if (buflist_buf != NULL) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2037 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2038 /* Read the next line. If it has the "*" mark compare the |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2039 * time stamps. Write entries from "buflist" that are |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2040 * newer. */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2041 if (!(eof = viminfo_readline(virp)) && line[0] == TAB) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2042 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2043 did_read_line = TRUE; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2044 if (line[1] == '*') |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2045 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2046 long ltime; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2047 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2048 sscanf((char *)line + 2, "%ld ", <ime); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2049 while ((time_T)ltime < buflist_buf->b_last_used) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2050 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2051 write_buffer_marks(buflist_buf, fp_out); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2052 if (++count >= num_marked_files) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2053 break; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2054 if (++buflist_used == buflist->ga_len) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2055 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2056 buflist_buf = NULL; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2057 break; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2058 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2059 buflist_buf = |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2060 ((buf_T **)buflist->ga_data)[buflist_used]; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2061 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2062 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2063 else |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2064 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2065 /* No timestamp, must be written by an older Vim. |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2066 * Assume all remaining buffers are older then |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2067 * ours. */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2068 while (count < num_marked_files |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2069 && buflist_used < buflist->ga_len) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2070 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2071 buflist_buf = ((buf_T **)buflist->ga_data) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2072 [buflist_used++]; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2073 write_buffer_marks(buflist_buf, fp_out); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2074 ++count; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2075 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2076 buflist_buf = NULL; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2077 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2078 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2079 if (count >= num_marked_files) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2080 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2081 vim_free(str); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2082 break; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2083 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2084 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2085 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2086 |
7 | 2087 fputs("\n> ", fp_out); |
2088 viminfo_writestring(fp_out, str); | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2089 if (did_read_line) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2090 fputs((char *)line, fp_out); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2091 |
7 | 2092 count++; |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2093 copy_marks_out = TRUE; |
7 | 2094 } |
2095 } | |
2096 vim_free(str); | |
2097 | |
2098 #ifdef FEAT_VIRTUALEDIT | |
2099 pos.coladd = 0; | |
2100 #endif | |
2101 while (!(eof = viminfo_readline(virp)) && line[0] == TAB) | |
2102 { | |
2103 if (load_marks) | |
2104 { | |
2105 if (line[1] != NUL) | |
2106 { | |
2712 | 2107 unsigned u; |
2108 | |
2109 sscanf((char *)line + 2, "%ld %u", &pos.lnum, &u); | |
2110 pos.col = u; | |
7 | 2111 switch (line[1]) |
2112 { | |
2113 case '"': curbuf->b_last_cursor = pos; break; | |
2114 case '^': curbuf->b_last_insert = pos; break; | |
2115 case '.': curbuf->b_last_change = pos; break; | |
2116 case '+': | |
2117 #ifdef FEAT_JUMPLIST | |
2118 /* changelist positions are stored oldest | |
2119 * first */ | |
2120 if (curbuf->b_changelistlen == JUMPLISTSIZE) | |
2121 /* list is full, remove oldest entry */ | |
2122 mch_memmove(curbuf->b_changelist, | |
2123 curbuf->b_changelist + 1, | |
2124 sizeof(pos_T) * (JUMPLISTSIZE - 1)); | |
2125 else | |
2126 ++curbuf->b_changelistlen; | |
2127 curbuf->b_changelist[ | |
2128 curbuf->b_changelistlen - 1] = pos; | |
2129 #endif | |
2130 break; | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2131 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2132 /* Using the line number for the last-used |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2133 * timestamp. */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2134 case '*': curbuf->b_last_used = pos.lnum; break; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2135 |
7 | 2136 default: if ((i = line[1] - 'a') >= 0 && i < NMARKS) |
2137 curbuf->b_namedm[i] = pos; | |
2138 } | |
2139 } | |
2140 } | |
2141 else if (copy_marks_out) | |
2142 fputs((char *)line, fp_out); | |
2143 } | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2144 |
7 | 2145 if (load_marks) |
2146 { | |
2147 #ifdef FEAT_JUMPLIST | |
2148 win_T *wp; | |
2149 | |
2150 FOR_ALL_WINDOWS(wp) | |
2151 { | |
2152 if (wp->w_buffer == curbuf) | |
2153 wp->w_changelistidx = curbuf->b_changelistlen; | |
2154 } | |
2155 #endif | |
2156 break; | |
2157 } | |
2158 } | |
9414
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2159 |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2160 if (fp_out != NULL) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2161 /* Write any remaining entries from buflist. */ |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2162 while (count < num_marked_files && buflist_used < buflist->ga_len) |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2163 { |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2164 buflist_buf = ((buf_T **)buflist->ga_data)[buflist_used++]; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2165 write_buffer_marks(buflist_buf, fp_out); |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2166 ++count; |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2167 } |
1003973c99df
commit https://github.com/vim/vim/commit/ab9c89b68dcbdb3fbda8c5a50dd90caca64f1bfd
Christian Brabandt <cb@256bit.org>
parents:
9401
diff
changeset
|
2168 |
7 | 2169 vim_free(name_buf); |
2170 } | |
2171 #endif /* FEAT_VIMINFO */ |