Mercurial > vim
comparison src/mark.c @ 18800:f41b55f9357c v8.1.2388
patch 8.1.2388: using old C style comments
Commit: https://github.com/vim/vim/commit/4ba37b5833de99db9e9afe8928b31c864182405c
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 4 21:57:43 2019 +0100
patch 8.1.2388: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 04 Dec 2019 22:00:04 +0100 |
parents | f89e2e720b5b |
children | de2d1820215a |
comparison
equal
deleted
inserted
replaced
18799:d7d0942e231b | 18800:f41b55f9357c |
---|---|
22 * If a named file mark's fnum is non-zero, it is for an existing buffer, | 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. | 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 | 24 * There are marks 'A - 'Z (set by user) and '0 to '9 (set when writing |
25 * viminfo). | 25 * viminfo). |
26 */ | 26 */ |
27 static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; /* marks with file nr */ | 27 static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; // marks with file nr |
28 | 28 |
29 static void fname2fnum(xfmark_T *fm); | 29 static void fname2fnum(xfmark_T *fm); |
30 static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf); | 30 static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf); |
31 static char_u *mark_line(pos_T *mp, int lead_len); | 31 static char_u *mark_line(pos_T *mp, int lead_len); |
32 static void show_one_mark(int, char_u *, pos_T *, char_u *, int current); | 32 static void show_one_mark(int, char_u *, pos_T *, char_u *, int current); |
52 setmark_pos(int c, pos_T *pos, int fnum) | 52 setmark_pos(int c, pos_T *pos, int fnum) |
53 { | 53 { |
54 int i; | 54 int i; |
55 buf_T *buf; | 55 buf_T *buf; |
56 | 56 |
57 /* Check for a special key (may cause islower() to crash). */ | 57 // Check for a special key (may cause islower() to crash). |
58 if (c < 0) | 58 if (c < 0) |
59 return FAIL; | 59 return FAIL; |
60 | 60 |
61 if (c == '\'' || c == '`') | 61 if (c == '\'' || c == '`') |
62 { | 62 { |
63 if (pos == &curwin->w_cursor) | 63 if (pos == &curwin->w_cursor) |
64 { | 64 { |
65 setpcmark(); | 65 setpcmark(); |
66 /* keep it even when the cursor doesn't move */ | 66 // keep it even when the cursor doesn't move |
67 curwin->w_prev_pcmark = curwin->w_pcmark; | 67 curwin->w_prev_pcmark = curwin->w_pcmark; |
68 } | 68 } |
69 else | 69 else |
70 curwin->w_pcmark = *pos; | 70 curwin->w_pcmark = *pos; |
71 return OK; | 71 return OK; |
79 { | 79 { |
80 buf->b_last_cursor = *pos; | 80 buf->b_last_cursor = *pos; |
81 return OK; | 81 return OK; |
82 } | 82 } |
83 | 83 |
84 /* Allow setting '[ and '] for an autocommand that simulates reading a | 84 // Allow setting '[ and '] for an autocommand that simulates reading a |
85 * file. */ | 85 // file. |
86 if (c == '[') | 86 if (c == '[') |
87 { | 87 { |
88 buf->b_op_start = *pos; | 88 buf->b_op_start = *pos; |
89 return OK; | 89 return OK; |
90 } | 90 } |
99 if (c == '<') | 99 if (c == '<') |
100 buf->b_visual.vi_start = *pos; | 100 buf->b_visual.vi_start = *pos; |
101 else | 101 else |
102 buf->b_visual.vi_end = *pos; | 102 buf->b_visual.vi_end = *pos; |
103 if (buf->b_visual.vi_mode == NUL) | 103 if (buf->b_visual.vi_mode == NUL) |
104 /* Visual_mode has not yet been set, use a sane default. */ | 104 // Visual_mode has not yet been set, use a sane default. |
105 buf->b_visual.vi_mode = 'v'; | 105 buf->b_visual.vi_mode = 'v'; |
106 return OK; | 106 return OK; |
107 } | 107 } |
108 | 108 |
109 if (ASCII_ISLOWER(c)) | 109 if (ASCII_ISLOWER(c)) |
142 #endif | 142 #endif |
143 #ifdef JUMPLIST_ROTATE | 143 #ifdef JUMPLIST_ROTATE |
144 xfmark_T tempmark; | 144 xfmark_T tempmark; |
145 #endif | 145 #endif |
146 | 146 |
147 /* for :global the mark is set only once */ | 147 // for :global the mark is set only once |
148 if (global_busy || listcmd_busy || cmdmod.keepjumps) | 148 if (global_busy || listcmd_busy || cmdmod.keepjumps) |
149 return; | 149 return; |
150 | 150 |
151 curwin->w_prev_pcmark = curwin->w_pcmark; | 151 curwin->w_prev_pcmark = curwin->w_pcmark; |
152 curwin->w_pcmark = curwin->w_cursor; | 152 curwin->w_pcmark = curwin->w_cursor; |
168 curwin->w_jumplist[0] = tempmark; | 168 curwin->w_jumplist[0] = tempmark; |
169 ++curwin->w_jumplistidx; | 169 ++curwin->w_jumplistidx; |
170 } | 170 } |
171 # endif | 171 # endif |
172 | 172 |
173 /* If jumplist is full: remove oldest entry */ | 173 // If jumplist is full: remove oldest entry |
174 if (++curwin->w_jumplistlen > JUMPLISTSIZE) | 174 if (++curwin->w_jumplistlen > JUMPLISTSIZE) |
175 { | 175 { |
176 curwin->w_jumplistlen = JUMPLISTSIZE; | 176 curwin->w_jumplistlen = JUMPLISTSIZE; |
177 vim_free(curwin->w_jumplist[0].fname); | 177 vim_free(curwin->w_jumplist[0].fname); |
178 for (i = 1; i < JUMPLISTSIZE; ++i) | 178 for (i = 1; i < JUMPLISTSIZE; ++i) |
202 if (curwin->w_prev_pcmark.lnum != 0 | 202 if (curwin->w_prev_pcmark.lnum != 0 |
203 && (EQUAL_POS(curwin->w_pcmark, curwin->w_cursor) | 203 && (EQUAL_POS(curwin->w_pcmark, curwin->w_cursor) |
204 || curwin->w_pcmark.lnum == 0)) | 204 || curwin->w_pcmark.lnum == 0)) |
205 { | 205 { |
206 curwin->w_pcmark = curwin->w_prev_pcmark; | 206 curwin->w_pcmark = curwin->w_prev_pcmark; |
207 curwin->w_prev_pcmark.lnum = 0; /* Show it has been checked */ | 207 curwin->w_prev_pcmark.lnum = 0; // Show it has been checked |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 #if defined(FEAT_JUMPLIST) || defined(PROTO) | 211 #if defined(FEAT_JUMPLIST) || defined(PROTO) |
212 /* | 212 /* |
218 pos_T *pos; | 218 pos_T *pos; |
219 xfmark_T *jmp; | 219 xfmark_T *jmp; |
220 | 220 |
221 cleanup_jumplist(curwin, TRUE); | 221 cleanup_jumplist(curwin, TRUE); |
222 | 222 |
223 if (curwin->w_jumplistlen == 0) /* nothing to jump to */ | 223 if (curwin->w_jumplistlen == 0) // nothing to jump to |
224 return (pos_T *)NULL; | 224 return (pos_T *)NULL; |
225 | 225 |
226 for (;;) | 226 for (;;) |
227 { | 227 { |
228 if (curwin->w_jumplistidx + count < 0 | 228 if (curwin->w_jumplistidx + count < 0 |
235 * starting Vim on a file), another entry may have been removed. | 235 * starting Vim on a file), another entry may have been removed. |
236 */ | 236 */ |
237 if (curwin->w_jumplistidx == curwin->w_jumplistlen) | 237 if (curwin->w_jumplistidx == curwin->w_jumplistlen) |
238 { | 238 { |
239 setpcmark(); | 239 setpcmark(); |
240 --curwin->w_jumplistidx; /* skip the new entry */ | 240 --curwin->w_jumplistidx; // skip the new entry |
241 if (curwin->w_jumplistidx + count < 0) | 241 if (curwin->w_jumplistidx + count < 0) |
242 return (pos_T *)NULL; | 242 return (pos_T *)NULL; |
243 } | 243 } |
244 | 244 |
245 curwin->w_jumplistidx += count; | 245 curwin->w_jumplistidx += count; |
247 jmp = curwin->w_jumplist + curwin->w_jumplistidx; | 247 jmp = curwin->w_jumplist + curwin->w_jumplistidx; |
248 if (jmp->fmark.fnum == 0) | 248 if (jmp->fmark.fnum == 0) |
249 fname2fnum(jmp); | 249 fname2fnum(jmp); |
250 if (jmp->fmark.fnum != curbuf->b_fnum) | 250 if (jmp->fmark.fnum != curbuf->b_fnum) |
251 { | 251 { |
252 /* jump to other file */ | 252 // jump to other file |
253 if (buflist_findnr(jmp->fmark.fnum) == NULL) | 253 if (buflist_findnr(jmp->fmark.fnum) == NULL) |
254 { /* Skip this one .. */ | 254 { // Skip this one .. |
255 count += count < 0 ? -1 : 1; | 255 count += count < 0 ? -1 : 1; |
256 continue; | 256 continue; |
257 } | 257 } |
258 if (buflist_getfile(jmp->fmark.fnum, jmp->fmark.mark.lnum, | 258 if (buflist_getfile(jmp->fmark.fnum, jmp->fmark.mark.lnum, |
259 0, FALSE) == FAIL) | 259 0, FALSE) == FAIL) |
260 return (pos_T *)NULL; | 260 return (pos_T *)NULL; |
261 /* Set lnum again, autocommands my have changed it */ | 261 // Set lnum again, autocommands my have changed it |
262 curwin->w_cursor = jmp->fmark.mark; | 262 curwin->w_cursor = jmp->fmark.mark; |
263 pos = (pos_T *)-1; | 263 pos = (pos_T *)-1; |
264 } | 264 } |
265 else | 265 else |
266 pos = &(jmp->fmark.mark); | 266 pos = &(jmp->fmark.mark); |
274 pos_T * | 274 pos_T * |
275 movechangelist(int count) | 275 movechangelist(int count) |
276 { | 276 { |
277 int n; | 277 int n; |
278 | 278 |
279 if (curbuf->b_changelistlen == 0) /* nothing to jump to */ | 279 if (curbuf->b_changelistlen == 0) // nothing to jump to |
280 return (pos_T *)NULL; | 280 return (pos_T *)NULL; |
281 | 281 |
282 n = curwin->w_changelistidx; | 282 n = curwin->w_changelistidx; |
283 if (n + count < 0) | 283 if (n + count < 0) |
284 { | 284 { |
333 pos_T *startp, *endp; | 333 pos_T *startp, *endp; |
334 static pos_T pos_copy; | 334 static pos_T pos_copy; |
335 | 335 |
336 posp = NULL; | 336 posp = NULL; |
337 | 337 |
338 /* Check for special key, can't be a mark name and might cause islower() | 338 // Check for special key, can't be a mark name and might cause islower() |
339 * to crash. */ | 339 // to crash. |
340 if (c < 0) | 340 if (c < 0) |
341 return posp; | 341 return posp; |
342 #ifndef EBCDIC | 342 #ifndef EBCDIC |
343 if (c > '~') /* check for islower()/isupper() */ | 343 if (c > '~') // check for islower()/isupper() |
344 ; | 344 ; |
345 else | 345 else |
346 #endif | 346 #endif |
347 if (c == '\'' || c == '`') /* previous context mark */ | 347 if (c == '\'' || c == '`') // previous context mark |
348 { | 348 { |
349 pos_copy = curwin->w_pcmark; /* need to make a copy because */ | 349 pos_copy = curwin->w_pcmark; // need to make a copy because |
350 posp = &pos_copy; /* w_pcmark may be changed soon */ | 350 posp = &pos_copy; // w_pcmark may be changed soon |
351 } | 351 } |
352 else if (c == '"') /* to pos when leaving buffer */ | 352 else if (c == '"') // to pos when leaving buffer |
353 posp = &(buf->b_last_cursor); | 353 posp = &(buf->b_last_cursor); |
354 else if (c == '^') /* to where Insert mode stopped */ | 354 else if (c == '^') // to where Insert mode stopped |
355 posp = &(buf->b_last_insert); | 355 posp = &(buf->b_last_insert); |
356 else if (c == '.') /* to where last change was made */ | 356 else if (c == '.') // to where last change was made |
357 posp = &(buf->b_last_change); | 357 posp = &(buf->b_last_change); |
358 else if (c == '[') /* to start of previous operator */ | 358 else if (c == '[') // to start of previous operator |
359 posp = &(buf->b_op_start); | 359 posp = &(buf->b_op_start); |
360 else if (c == ']') /* to end of previous operator */ | 360 else if (c == ']') // to end of previous operator |
361 posp = &(buf->b_op_end); | 361 posp = &(buf->b_op_end); |
362 else if (c == '{' || c == '}') /* to previous/next paragraph */ | 362 else if (c == '{' || c == '}') // to previous/next paragraph |
363 { | 363 { |
364 pos_T pos; | 364 pos_T pos; |
365 oparg_T oa; | 365 oparg_T oa; |
366 int slcb = listcmd_busy; | 366 int slcb = listcmd_busy; |
367 | 367 |
368 pos = curwin->w_cursor; | 368 pos = curwin->w_cursor; |
369 listcmd_busy = TRUE; /* avoid that '' is changed */ | 369 listcmd_busy = TRUE; // avoid that '' is changed |
370 if (findpar(&oa.inclusive, | 370 if (findpar(&oa.inclusive, |
371 c == '}' ? FORWARD : BACKWARD, 1L, NUL, FALSE)) | 371 c == '}' ? FORWARD : BACKWARD, 1L, NUL, FALSE)) |
372 { | 372 { |
373 pos_copy = curwin->w_cursor; | 373 pos_copy = curwin->w_cursor; |
374 posp = &pos_copy; | 374 posp = &pos_copy; |
375 } | 375 } |
376 curwin->w_cursor = pos; | 376 curwin->w_cursor = pos; |
377 listcmd_busy = slcb; | 377 listcmd_busy = slcb; |
378 } | 378 } |
379 else if (c == '(' || c == ')') /* to previous/next sentence */ | 379 else if (c == '(' || c == ')') // to previous/next sentence |
380 { | 380 { |
381 pos_T pos; | 381 pos_T pos; |
382 int slcb = listcmd_busy; | 382 int slcb = listcmd_busy; |
383 | 383 |
384 pos = curwin->w_cursor; | 384 pos = curwin->w_cursor; |
385 listcmd_busy = TRUE; /* avoid that '' is changed */ | 385 listcmd_busy = TRUE; // avoid that '' is changed |
386 if (findsent(c == ')' ? FORWARD : BACKWARD, 1L)) | 386 if (findsent(c == ')' ? FORWARD : BACKWARD, 1L)) |
387 { | 387 { |
388 pos_copy = curwin->w_cursor; | 388 pos_copy = curwin->w_cursor; |
389 posp = &pos_copy; | 389 posp = &pos_copy; |
390 } | 390 } |
391 curwin->w_cursor = pos; | 391 curwin->w_cursor = pos; |
392 listcmd_busy = slcb; | 392 listcmd_busy = slcb; |
393 } | 393 } |
394 else if (c == '<' || c == '>') /* start/end of visual area */ | 394 else if (c == '<' || c == '>') // start/end of visual area |
395 { | 395 { |
396 startp = &buf->b_visual.vi_start; | 396 startp = &buf->b_visual.vi_start; |
397 endp = &buf->b_visual.vi_end; | 397 endp = &buf->b_visual.vi_end; |
398 if (((c == '<') == LT_POS(*startp, *endp) || endp->lnum == 0) | 398 if (((c == '<') == LT_POS(*startp, *endp) || endp->lnum == 0) |
399 && startp->lnum != 0) | 399 && startp->lnum != 0) |
412 else | 412 else |
413 pos_copy.col = MAXCOL; | 413 pos_copy.col = MAXCOL; |
414 pos_copy.coladd = 0; | 414 pos_copy.coladd = 0; |
415 } | 415 } |
416 } | 416 } |
417 else if (ASCII_ISLOWER(c)) /* normal named mark */ | 417 else if (ASCII_ISLOWER(c)) // normal named mark |
418 { | 418 { |
419 posp = &(buf->b_namedm[c - 'a']); | 419 posp = &(buf->b_namedm[c - 'a']); |
420 } | 420 } |
421 else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) /* named file mark */ | 421 else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) // named file mark |
422 { | 422 { |
423 if (VIM_ISDIGIT(c)) | 423 if (VIM_ISDIGIT(c)) |
424 c = c - '0' + NMARKS; | 424 c = c - '0' + NMARKS; |
425 else | 425 else |
426 c -= 'A'; | 426 c -= 'A'; |
431 | 431 |
432 if (fnum != NULL) | 432 if (fnum != NULL) |
433 *fnum = namedfm[c].fmark.fnum; | 433 *fnum = namedfm[c].fmark.fnum; |
434 else if (namedfm[c].fmark.fnum != buf->b_fnum) | 434 else if (namedfm[c].fmark.fnum != buf->b_fnum) |
435 { | 435 { |
436 /* mark is in another file */ | 436 // mark is in another file |
437 posp = &pos_copy; | 437 posp = &pos_copy; |
438 | 438 |
439 if (namedfm[c].fmark.mark.lnum != 0 | 439 if (namedfm[c].fmark.mark.lnum != 0 |
440 && changefile && namedfm[c].fmark.fnum) | 440 && changefile && namedfm[c].fmark.fnum) |
441 { | 441 { |
442 if (buflist_getfile(namedfm[c].fmark.fnum, | 442 if (buflist_getfile(namedfm[c].fmark.fnum, |
443 (linenr_T)1, GETF_SETMARK, FALSE) == OK) | 443 (linenr_T)1, GETF_SETMARK, FALSE) == OK) |
444 { | 444 { |
445 /* Set the lnum now, autocommands could have changed it */ | 445 // Set the lnum now, autocommands could have changed it |
446 curwin->w_cursor = namedfm[c].fmark.mark; | 446 curwin->w_cursor = namedfm[c].fmark.mark; |
447 return (pos_T *)-1; | 447 return (pos_T *)-1; |
448 } | 448 } |
449 pos_copy.lnum = -1; /* can't get file */ | 449 pos_copy.lnum = -1; // can't get file |
450 } | 450 } |
451 else | 451 else |
452 pos_copy.lnum = 0; /* mark exists, but is not valid in | 452 pos_copy.lnum = 0; // mark exists, but is not valid in |
453 current buffer */ | 453 // current buffer |
454 } | 454 } |
455 } | 455 } |
456 | 456 |
457 return posp; | 457 return posp; |
458 } | 458 } |
462 * | 462 * |
463 * Returns pointer to pos_T of the next mark or NULL if no mark is found. | 463 * Returns pointer to pos_T of the next mark or NULL if no mark is found. |
464 */ | 464 */ |
465 pos_T * | 465 pos_T * |
466 getnextmark( | 466 getnextmark( |
467 pos_T *startpos, /* where to start */ | 467 pos_T *startpos, // where to start |
468 int dir, /* direction for search */ | 468 int dir, // direction for search |
469 int begin_line) | 469 int begin_line) |
470 { | 470 { |
471 int i; | 471 int i; |
472 pos_T *result = NULL; | 472 pos_T *result = NULL; |
473 pos_T pos; | 473 pos_T pos; |
474 | 474 |
475 pos = *startpos; | 475 pos = *startpos; |
476 | 476 |
477 /* When searching backward and leaving the cursor on the first non-blank, | 477 // When searching backward and leaving the cursor on the first non-blank, |
478 * position must be in a previous line. | 478 // position must be in a previous line. |
479 * When searching forward and leaving the cursor on the first non-blank, | 479 // When searching forward and leaving the cursor on the first non-blank, |
480 * position must be in a next line. */ | 480 // position must be in a next line. |
481 if (dir == BACKWARD && begin_line) | 481 if (dir == BACKWARD && begin_line) |
482 pos.col = 0; | 482 pos.col = 0; |
483 else if (dir == FORWARD && begin_line) | 483 else if (dir == FORWARD && begin_line) |
484 pos.col = MAXCOL; | 484 pos.col = MAXCOL; |
485 | 485 |
534 vim_strncpy(NameBuff + len, fm->fname + 2, MAXPATHL - len - 1); | 534 vim_strncpy(NameBuff + len, fm->fname + 2, MAXPATHL - len - 1); |
535 } | 535 } |
536 else | 536 else |
537 vim_strncpy(NameBuff, fm->fname, MAXPATHL - 1); | 537 vim_strncpy(NameBuff, fm->fname, MAXPATHL - 1); |
538 | 538 |
539 /* Try to shorten the file name. */ | 539 // Try to shorten the file name. |
540 mch_dirname(IObuff, IOSIZE); | 540 mch_dirname(IObuff, IOSIZE); |
541 p = shorten_fname(NameBuff, IObuff); | 541 p = shorten_fname(NameBuff, IObuff); |
542 | 542 |
543 /* buflist_new() will call fmarks_check_names() */ | 543 // buflist_new() will call fmarks_check_names() |
544 (void)buflist_new(NameBuff, p, (linenr_T)1, 0); | 544 (void)buflist_new(NameBuff, p, (linenr_T)1, 0); |
545 } | 545 } |
546 } | 546 } |
547 | 547 |
548 /* | 548 /* |
604 emsg(_(e_umark)); | 604 emsg(_(e_umark)); |
605 return FAIL; | 605 return FAIL; |
606 } | 606 } |
607 if (pos->lnum <= 0) | 607 if (pos->lnum <= 0) |
608 { | 608 { |
609 /* lnum is negative if mark is in another file can can't get that | 609 // lnum is negative if mark is in another file can can't get that |
610 * file, error message already give then. */ | 610 // file, error message already give then. |
611 if (pos->lnum == 0) | 611 if (pos->lnum == 0) |
612 emsg(_(e_marknotset)); | 612 emsg(_(e_marknotset)); |
613 return FAIL; | 613 return FAIL; |
614 } | 614 } |
615 if (pos->lnum > curbuf->b_ml.ml_line_count) | 615 if (pos->lnum > curbuf->b_ml.ml_line_count) |
628 void | 628 void |
629 clrallmarks(buf_T *buf) | 629 clrallmarks(buf_T *buf) |
630 { | 630 { |
631 static int i = -1; | 631 static int i = -1; |
632 | 632 |
633 if (i == -1) /* first call ever: initialize */ | 633 if (i == -1) // first call ever: initialize |
634 for (i = 0; i < NMARKS + 1; i++) | 634 for (i = 0; i < NMARKS + 1; i++) |
635 { | 635 { |
636 namedfm[i].fmark.mark.lnum = 0; | 636 namedfm[i].fmark.mark.lnum = 0; |
637 namedfm[i].fname = NULL; | 637 namedfm[i].fname = NULL; |
638 #ifdef FEAT_VIMINFO | 638 #ifdef FEAT_VIMINFO |
640 #endif | 640 #endif |
641 } | 641 } |
642 | 642 |
643 for (i = 0; i < NMARKS; i++) | 643 for (i = 0; i < NMARKS; i++) |
644 buf->b_namedm[i].lnum = 0; | 644 buf->b_namedm[i].lnum = 0; |
645 buf->b_op_start.lnum = 0; /* start/end op mark cleared */ | 645 buf->b_op_start.lnum = 0; // start/end op mark cleared |
646 buf->b_op_end.lnum = 0; | 646 buf->b_op_end.lnum = 0; |
647 buf->b_last_cursor.lnum = 1; /* '" mark cleared */ | 647 buf->b_last_cursor.lnum = 1; // '" mark cleared |
648 buf->b_last_cursor.col = 0; | 648 buf->b_last_cursor.col = 0; |
649 buf->b_last_cursor.coladd = 0; | 649 buf->b_last_cursor.coladd = 0; |
650 buf->b_last_insert.lnum = 0; /* '^ mark cleared */ | 650 buf->b_last_insert.lnum = 0; // '^ mark cleared |
651 buf->b_last_change.lnum = 0; /* '. mark cleared */ | 651 buf->b_last_change.lnum = 0; // '. mark cleared |
652 #ifdef FEAT_JUMPLIST | 652 #ifdef FEAT_JUMPLIST |
653 buf->b_changelistlen = 0; | 653 buf->b_changelistlen = 0; |
654 #endif | 654 #endif |
655 } | 655 } |
656 | 656 |
660 * Returns an allocated string. | 660 * Returns an allocated string. |
661 */ | 661 */ |
662 char_u * | 662 char_u * |
663 fm_getname(fmark_T *fmark, int lead_len) | 663 fm_getname(fmark_T *fmark, int lead_len) |
664 { | 664 { |
665 if (fmark->fnum == curbuf->b_fnum) /* current buffer */ | 665 if (fmark->fnum == curbuf->b_fnum) // current buffer |
666 return mark_line(&(fmark->mark), lead_len); | 666 return mark_line(&(fmark->mark), lead_len); |
667 return buflist_nr2name(fmark->fnum, FALSE, TRUE); | 667 return buflist_nr2name(fmark->fnum, FALSE, TRUE); |
668 } | 668 } |
669 | 669 |
670 /* | 670 /* |
740 show_one_mark( | 740 show_one_mark( |
741 int c, | 741 int c, |
742 char_u *arg, | 742 char_u *arg, |
743 pos_T *p, | 743 pos_T *p, |
744 char_u *name_arg, | 744 char_u *name_arg, |
745 int current) /* in current file */ | 745 int current) // in current file |
746 { | 746 { |
747 static int did_title = FALSE; | 747 static int did_title = FALSE; |
748 int mustfree = FALSE; | 748 int mustfree = FALSE; |
749 char_u *name = name_arg; | 749 char_u *name = name_arg; |
750 | 750 |
751 if (c == -1) /* finish up */ | 751 if (c == -1) // finish up |
752 { | 752 { |
753 if (did_title) | 753 if (did_title) |
754 did_title = FALSE; | 754 did_title = FALSE; |
755 else | 755 else |
756 { | 756 { |
807 int lower; | 807 int lower; |
808 int digit; | 808 int digit; |
809 int n; | 809 int n; |
810 | 810 |
811 if (*eap->arg == NUL && eap->forceit) | 811 if (*eap->arg == NUL && eap->forceit) |
812 /* clear all marks */ | 812 // clear all marks |
813 clrallmarks(curbuf); | 813 clrallmarks(curbuf); |
814 else if (eap->forceit) | 814 else if (eap->forceit) |
815 emsg(_(e_invarg)); | 815 emsg(_(e_invarg)); |
816 else if (*eap->arg == NUL) | 816 else if (*eap->arg == NUL) |
817 emsg(_(e_argreq)); | 817 emsg(_(e_argreq)); |
818 else | 818 else |
819 { | 819 { |
820 /* clear specified marks only */ | 820 // clear specified marks only |
821 for (p = eap->arg; *p != NUL; ++p) | 821 for (p = eap->arg; *p != NUL; ++p) |
822 { | 822 { |
823 lower = ASCII_ISLOWER(*p); | 823 lower = ASCII_ISLOWER(*p); |
824 digit = VIM_ISDIGIT(*p); | 824 digit = VIM_ISDIGIT(*p); |
825 if (lower || digit || ASCII_ISUPPER(*p)) | 825 if (lower || digit || ASCII_ISUPPER(*p)) |
826 { | 826 { |
827 if (p[1] == '-') | 827 if (p[1] == '-') |
828 { | 828 { |
829 /* clear range of marks */ | 829 // clear range of marks |
830 from = *p; | 830 from = *p; |
831 to = p[2]; | 831 to = p[2]; |
832 if (!(lower ? ASCII_ISLOWER(p[2]) | 832 if (!(lower ? ASCII_ISLOWER(p[2]) |
833 : (digit ? VIM_ISDIGIT(p[2]) | 833 : (digit ? VIM_ISDIGIT(p[2]) |
834 : ASCII_ISUPPER(p[2]))) | 834 : ASCII_ISUPPER(p[2]))) |
838 return; | 838 return; |
839 } | 839 } |
840 p += 2; | 840 p += 2; |
841 } | 841 } |
842 else | 842 else |
843 /* clear one lower case mark */ | 843 // clear one lower case mark |
844 from = to = *p; | 844 from = to = *p; |
845 | 845 |
846 for (i = from; i <= to; ++i) | 846 for (i = from; i <= to; ++i) |
847 { | 847 { |
848 if (lower) | 848 if (lower) |
889 int i; | 889 int i; |
890 char_u *name; | 890 char_u *name; |
891 | 891 |
892 cleanup_jumplist(curwin, TRUE); | 892 cleanup_jumplist(curwin, TRUE); |
893 | 893 |
894 /* Highlight title */ | 894 // Highlight title |
895 msg_puts_title(_("\n jump line col file/text")); | 895 msg_puts_title(_("\n jump line col file/text")); |
896 for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) | 896 for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) |
897 { | 897 { |
898 if (curwin->w_jumplist[i].fmark.mark.lnum != 0) | 898 if (curwin->w_jumplist[i].fmark.mark.lnum != 0) |
899 { | 899 { |
946 ex_changes(exarg_T *eap UNUSED) | 946 ex_changes(exarg_T *eap UNUSED) |
947 { | 947 { |
948 int i; | 948 int i; |
949 char_u *name; | 949 char_u *name; |
950 | 950 |
951 /* Highlight title */ | 951 // Highlight title |
952 msg_puts_title(_("\nchange line col text")); | 952 msg_puts_title(_("\nchange line col text")); |
953 | 953 |
954 for (i = 0; i < curbuf->b_changelistlen && !got_int; ++i) | 954 for (i = 0; i < curbuf->b_changelistlen && !got_int; ++i) |
955 { | 955 { |
956 if (curbuf->b_changelist[i].lnum != 0) | 956 if (curbuf->b_changelist[i].lnum != 0) |
991 } \ | 991 } \ |
992 else if (amount_after && *lp > line2) \ | 992 else if (amount_after && *lp > line2) \ |
993 *lp += amount_after; \ | 993 *lp += amount_after; \ |
994 } | 994 } |
995 | 995 |
996 /* don't delete the line, just put at first deleted line */ | 996 // don't delete the line, just put at first deleted line |
997 #define one_adjust_nodel(add) \ | 997 #define one_adjust_nodel(add) \ |
998 { \ | 998 { \ |
999 lp = add; \ | 999 lp = add; \ |
1000 if (*lp >= line1 && *lp <= line2) \ | 1000 if (*lp >= line1 && *lp <= line2) \ |
1001 { \ | 1001 { \ |
1052 linenr_T *lp; | 1052 linenr_T *lp; |
1053 win_T *win; | 1053 win_T *win; |
1054 tabpage_T *tab; | 1054 tabpage_T *tab; |
1055 static pos_T initpos = {1, 0, 0}; | 1055 static pos_T initpos = {1, 0, 0}; |
1056 | 1056 |
1057 if (line2 < line1 && amount_after == 0L) /* nothing to do */ | 1057 if (line2 < line1 && amount_after == 0L) // nothing to do |
1058 return; | 1058 return; |
1059 | 1059 |
1060 if (!cmdmod.lockmarks) | 1060 if (!cmdmod.lockmarks) |
1061 { | 1061 { |
1062 /* named marks, lower case and upper case */ | 1062 // named marks, lower case and upper case |
1063 for (i = 0; i < NMARKS; i++) | 1063 for (i = 0; i < NMARKS; i++) |
1064 { | 1064 { |
1065 one_adjust(&(curbuf->b_namedm[i].lnum)); | 1065 one_adjust(&(curbuf->b_namedm[i].lnum)); |
1066 if (namedfm[i].fmark.fnum == fnum) | 1066 if (namedfm[i].fmark.fnum == fnum) |
1067 one_adjust_nodel(&(namedfm[i].fmark.mark.lnum)); | 1067 one_adjust_nodel(&(namedfm[i].fmark.mark.lnum)); |
1070 { | 1070 { |
1071 if (namedfm[i].fmark.fnum == fnum) | 1071 if (namedfm[i].fmark.fnum == fnum) |
1072 one_adjust_nodel(&(namedfm[i].fmark.mark.lnum)); | 1072 one_adjust_nodel(&(namedfm[i].fmark.mark.lnum)); |
1073 } | 1073 } |
1074 | 1074 |
1075 /* last Insert position */ | 1075 // last Insert position |
1076 one_adjust(&(curbuf->b_last_insert.lnum)); | 1076 one_adjust(&(curbuf->b_last_insert.lnum)); |
1077 | 1077 |
1078 /* last change position */ | 1078 // last change position |
1079 one_adjust(&(curbuf->b_last_change.lnum)); | 1079 one_adjust(&(curbuf->b_last_change.lnum)); |
1080 | 1080 |
1081 /* last cursor position, if it was set */ | 1081 // last cursor position, if it was set |
1082 if (!EQUAL_POS(curbuf->b_last_cursor, initpos)) | 1082 if (!EQUAL_POS(curbuf->b_last_cursor, initpos)) |
1083 one_adjust(&(curbuf->b_last_cursor.lnum)); | 1083 one_adjust(&(curbuf->b_last_cursor.lnum)); |
1084 | 1084 |
1085 | 1085 |
1086 #ifdef FEAT_JUMPLIST | 1086 #ifdef FEAT_JUMPLIST |
1087 /* list of change positions */ | 1087 // list of change positions |
1088 for (i = 0; i < curbuf->b_changelistlen; ++i) | 1088 for (i = 0; i < curbuf->b_changelistlen; ++i) |
1089 one_adjust_nodel(&(curbuf->b_changelist[i].lnum)); | 1089 one_adjust_nodel(&(curbuf->b_changelist[i].lnum)); |
1090 #endif | 1090 #endif |
1091 | 1091 |
1092 /* Visual area */ | 1092 // Visual area |
1093 one_adjust_nodel(&(curbuf->b_visual.vi_start.lnum)); | 1093 one_adjust_nodel(&(curbuf->b_visual.vi_start.lnum)); |
1094 one_adjust_nodel(&(curbuf->b_visual.vi_end.lnum)); | 1094 one_adjust_nodel(&(curbuf->b_visual.vi_end.lnum)); |
1095 | 1095 |
1096 #ifdef FEAT_QUICKFIX | 1096 #ifdef FEAT_QUICKFIX |
1097 /* quickfix marks */ | 1097 // quickfix marks |
1098 qf_mark_adjust(NULL, line1, line2, amount, amount_after); | 1098 qf_mark_adjust(NULL, line1, line2, amount, amount_after); |
1099 /* location lists */ | 1099 // location lists |
1100 FOR_ALL_TAB_WINDOWS(tab, win) | 1100 FOR_ALL_TAB_WINDOWS(tab, win) |
1101 qf_mark_adjust(win, line1, line2, amount, amount_after); | 1101 qf_mark_adjust(win, line1, line2, amount, amount_after); |
1102 #endif | 1102 #endif |
1103 | 1103 |
1104 #ifdef FEAT_SIGNS | 1104 #ifdef FEAT_SIGNS |
1105 sign_mark_adjust(line1, line2, amount, amount_after); | 1105 sign_mark_adjust(line1, line2, amount, amount_after); |
1106 #endif | 1106 #endif |
1107 } | 1107 } |
1108 | 1108 |
1109 /* previous context mark */ | 1109 // previous context mark |
1110 one_adjust(&(curwin->w_pcmark.lnum)); | 1110 one_adjust(&(curwin->w_pcmark.lnum)); |
1111 | 1111 |
1112 /* previous pcmark */ | 1112 // previous pcmark |
1113 one_adjust(&(curwin->w_prev_pcmark.lnum)); | 1113 one_adjust(&(curwin->w_prev_pcmark.lnum)); |
1114 | 1114 |
1115 /* saved cursor for formatting */ | 1115 // saved cursor for formatting |
1116 if (saved_cursor.lnum != 0) | 1116 if (saved_cursor.lnum != 0) |
1117 one_adjust_nodel(&(saved_cursor.lnum)); | 1117 one_adjust_nodel(&(saved_cursor.lnum)); |
1118 | 1118 |
1119 /* | 1119 /* |
1120 * Adjust items in all windows related to the current buffer. | 1120 * Adjust items in all windows related to the current buffer. |
1121 */ | 1121 */ |
1122 FOR_ALL_TAB_WINDOWS(tab, win) | 1122 FOR_ALL_TAB_WINDOWS(tab, win) |
1123 { | 1123 { |
1124 #ifdef FEAT_JUMPLIST | 1124 #ifdef FEAT_JUMPLIST |
1125 if (!cmdmod.lockmarks) | 1125 if (!cmdmod.lockmarks) |
1126 /* Marks in the jumplist. When deleting lines, this may create | 1126 // Marks in the jumplist. When deleting lines, this may create |
1127 * duplicate marks in the jumplist, they will be removed later. */ | 1127 // duplicate marks in the jumplist, they will be removed later. |
1128 for (i = 0; i < win->w_jumplistlen; ++i) | 1128 for (i = 0; i < win->w_jumplistlen; ++i) |
1129 if (win->w_jumplist[i].fmark.fnum == fnum) | 1129 if (win->w_jumplist[i].fmark.fnum == fnum) |
1130 one_adjust_nodel(&(win->w_jumplist[i].fmark.mark.lnum)); | 1130 one_adjust_nodel(&(win->w_jumplist[i].fmark.mark.lnum)); |
1131 #endif | 1131 #endif |
1132 | 1132 |
1133 if (win->w_buffer == curbuf) | 1133 if (win->w_buffer == curbuf) |
1134 { | 1134 { |
1135 if (!cmdmod.lockmarks) | 1135 if (!cmdmod.lockmarks) |
1136 /* marks in the tag stack */ | 1136 // marks in the tag stack |
1137 for (i = 0; i < win->w_tagstacklen; i++) | 1137 for (i = 0; i < win->w_tagstacklen; i++) |
1138 if (win->w_tagstack[i].fmark.fnum == fnum) | 1138 if (win->w_tagstack[i].fmark.fnum == fnum) |
1139 one_adjust_nodel(&(win->w_tagstack[i].fmark.mark.lnum)); | 1139 one_adjust_nodel(&(win->w_tagstack[i].fmark.mark.lnum)); |
1140 | 1140 |
1141 /* the displayed Visual area */ | 1141 // the displayed Visual area |
1142 if (win->w_old_cursor_lnum != 0) | 1142 if (win->w_old_cursor_lnum != 0) |
1143 { | 1143 { |
1144 one_adjust_nodel(&(win->w_old_cursor_lnum)); | 1144 one_adjust_nodel(&(win->w_old_cursor_lnum)); |
1145 one_adjust_nodel(&(win->w_old_visual_lnum)); | 1145 one_adjust_nodel(&(win->w_old_visual_lnum)); |
1146 } | 1146 } |
1147 | 1147 |
1148 /* topline and cursor position for windows with the same buffer | 1148 // topline and cursor position for windows with the same buffer |
1149 * other than the current window */ | 1149 // other than the current window |
1150 if (win != curwin) | 1150 if (win != curwin) |
1151 { | 1151 { |
1152 if (win->w_topline >= line1 && win->w_topline <= line2) | 1152 if (win->w_topline >= line1 && win->w_topline <= line2) |
1153 { | 1153 { |
1154 if (amount == MAXLNUM) /* topline is deleted */ | 1154 if (amount == MAXLNUM) // topline is deleted |
1155 { | 1155 { |
1156 if (line1 <= 1) | 1156 if (line1 <= 1) |
1157 win->w_topline = 1; | 1157 win->w_topline = 1; |
1158 else | 1158 else |
1159 win->w_topline = line1 - 1; | 1159 win->w_topline = line1 - 1; |
1160 } | 1160 } |
1161 else /* keep topline on the same line */ | 1161 else // keep topline on the same line |
1162 win->w_topline += amount; | 1162 win->w_topline += amount; |
1163 #ifdef FEAT_DIFF | 1163 #ifdef FEAT_DIFF |
1164 win->w_topfill = 0; | 1164 win->w_topfill = 0; |
1165 #endif | 1165 #endif |
1166 } | 1166 } |
1171 win->w_topfill = 0; | 1171 win->w_topfill = 0; |
1172 #endif | 1172 #endif |
1173 } | 1173 } |
1174 if (win->w_cursor.lnum >= line1 && win->w_cursor.lnum <= line2) | 1174 if (win->w_cursor.lnum >= line1 && win->w_cursor.lnum <= line2) |
1175 { | 1175 { |
1176 if (amount == MAXLNUM) /* line with cursor is deleted */ | 1176 if (amount == MAXLNUM) // line with cursor is deleted |
1177 { | 1177 { |
1178 if (line1 <= 1) | 1178 if (line1 <= 1) |
1179 win->w_cursor.lnum = 1; | 1179 win->w_cursor.lnum = 1; |
1180 else | 1180 else |
1181 win->w_cursor.lnum = line1 - 1; | 1181 win->w_cursor.lnum = line1 - 1; |
1182 win->w_cursor.col = 0; | 1182 win->w_cursor.col = 0; |
1183 } | 1183 } |
1184 else /* keep cursor on the same line */ | 1184 else // keep cursor on the same line |
1185 win->w_cursor.lnum += amount; | 1185 win->w_cursor.lnum += amount; |
1186 } | 1186 } |
1187 else if (amount_after && win->w_cursor.lnum > line2) | 1187 else if (amount_after && win->w_cursor.lnum > line2) |
1188 win->w_cursor.lnum += amount_after; | 1188 win->w_cursor.lnum += amount_after; |
1189 } | 1189 } |
1190 | 1190 |
1191 #ifdef FEAT_FOLDING | 1191 #ifdef FEAT_FOLDING |
1192 /* adjust folds */ | 1192 // adjust folds |
1193 if (adjust_folds) | 1193 if (adjust_folds) |
1194 foldMarkAdjust(win, line1, line2, amount, amount_after); | 1194 foldMarkAdjust(win, line1, line2, amount, amount_after); |
1195 #endif | 1195 #endif |
1196 } | 1196 } |
1197 } | 1197 } |
1198 | 1198 |
1199 #ifdef FEAT_DIFF | 1199 #ifdef FEAT_DIFF |
1200 /* adjust diffs */ | 1200 // adjust diffs |
1201 diff_mark_adjust(line1, line2, amount, amount_after); | 1201 diff_mark_adjust(line1, line2, amount, amount_after); |
1202 #endif | 1202 #endif |
1203 } | 1203 } |
1204 | 1204 |
1205 /* This code is used often, needs to be fast. */ | 1205 // This code is used often, needs to be fast. |
1206 #define col_adjust(pp) \ | 1206 #define col_adjust(pp) \ |
1207 { \ | 1207 { \ |
1208 posp = pp; \ | 1208 posp = pp; \ |
1209 if (posp->lnum == lnum && posp->col >= mincol) \ | 1209 if (posp->lnum == lnum && posp->col >= mincol) \ |
1210 { \ | 1210 { \ |
1237 int fnum = curbuf->b_fnum; | 1237 int fnum = curbuf->b_fnum; |
1238 win_T *win; | 1238 win_T *win; |
1239 pos_T *posp; | 1239 pos_T *posp; |
1240 | 1240 |
1241 if ((col_amount == 0L && lnum_amount == 0L) || cmdmod.lockmarks) | 1241 if ((col_amount == 0L && lnum_amount == 0L) || cmdmod.lockmarks) |
1242 return; /* nothing to do */ | 1242 return; // nothing to do |
1243 | 1243 |
1244 /* named marks, lower case and upper case */ | 1244 // named marks, lower case and upper case |
1245 for (i = 0; i < NMARKS; i++) | 1245 for (i = 0; i < NMARKS; i++) |
1246 { | 1246 { |
1247 col_adjust(&(curbuf->b_namedm[i])); | 1247 col_adjust(&(curbuf->b_namedm[i])); |
1248 if (namedfm[i].fmark.fnum == fnum) | 1248 if (namedfm[i].fmark.fnum == fnum) |
1249 col_adjust(&(namedfm[i].fmark.mark)); | 1249 col_adjust(&(namedfm[i].fmark.mark)); |
1252 { | 1252 { |
1253 if (namedfm[i].fmark.fnum == fnum) | 1253 if (namedfm[i].fmark.fnum == fnum) |
1254 col_adjust(&(namedfm[i].fmark.mark)); | 1254 col_adjust(&(namedfm[i].fmark.mark)); |
1255 } | 1255 } |
1256 | 1256 |
1257 /* last Insert position */ | 1257 // last Insert position |
1258 col_adjust(&(curbuf->b_last_insert)); | 1258 col_adjust(&(curbuf->b_last_insert)); |
1259 | 1259 |
1260 /* last change position */ | 1260 // last change position |
1261 col_adjust(&(curbuf->b_last_change)); | 1261 col_adjust(&(curbuf->b_last_change)); |
1262 | 1262 |
1263 #ifdef FEAT_JUMPLIST | 1263 #ifdef FEAT_JUMPLIST |
1264 /* list of change positions */ | 1264 // list of change positions |
1265 for (i = 0; i < curbuf->b_changelistlen; ++i) | 1265 for (i = 0; i < curbuf->b_changelistlen; ++i) |
1266 col_adjust(&(curbuf->b_changelist[i])); | 1266 col_adjust(&(curbuf->b_changelist[i])); |
1267 #endif | 1267 #endif |
1268 | 1268 |
1269 /* Visual area */ | 1269 // Visual area |
1270 col_adjust(&(curbuf->b_visual.vi_start)); | 1270 col_adjust(&(curbuf->b_visual.vi_start)); |
1271 col_adjust(&(curbuf->b_visual.vi_end)); | 1271 col_adjust(&(curbuf->b_visual.vi_end)); |
1272 | 1272 |
1273 /* previous context mark */ | 1273 // previous context mark |
1274 col_adjust(&(curwin->w_pcmark)); | 1274 col_adjust(&(curwin->w_pcmark)); |
1275 | 1275 |
1276 /* previous pcmark */ | 1276 // previous pcmark |
1277 col_adjust(&(curwin->w_prev_pcmark)); | 1277 col_adjust(&(curwin->w_prev_pcmark)); |
1278 | 1278 |
1279 /* saved cursor for formatting */ | 1279 // saved cursor for formatting |
1280 col_adjust(&saved_cursor); | 1280 col_adjust(&saved_cursor); |
1281 | 1281 |
1282 /* | 1282 /* |
1283 * Adjust items in all windows related to the current buffer. | 1283 * Adjust items in all windows related to the current buffer. |
1284 */ | 1284 */ |
1285 FOR_ALL_WINDOWS(win) | 1285 FOR_ALL_WINDOWS(win) |
1286 { | 1286 { |
1287 #ifdef FEAT_JUMPLIST | 1287 #ifdef FEAT_JUMPLIST |
1288 /* marks in the jumplist */ | 1288 // marks in the jumplist |
1289 for (i = 0; i < win->w_jumplistlen; ++i) | 1289 for (i = 0; i < win->w_jumplistlen; ++i) |
1290 if (win->w_jumplist[i].fmark.fnum == fnum) | 1290 if (win->w_jumplist[i].fmark.fnum == fnum) |
1291 col_adjust(&(win->w_jumplist[i].fmark.mark)); | 1291 col_adjust(&(win->w_jumplist[i].fmark.mark)); |
1292 #endif | 1292 #endif |
1293 | 1293 |
1294 if (win->w_buffer == curbuf) | 1294 if (win->w_buffer == curbuf) |
1295 { | 1295 { |
1296 /* marks in the tag stack */ | 1296 // marks in the tag stack |
1297 for (i = 0; i < win->w_tagstacklen; i++) | 1297 for (i = 0; i < win->w_tagstacklen; i++) |
1298 if (win->w_tagstack[i].fmark.fnum == fnum) | 1298 if (win->w_tagstack[i].fmark.fnum == fnum) |
1299 col_adjust(&(win->w_tagstack[i].fmark.mark)); | 1299 col_adjust(&(win->w_tagstack[i].fmark.mark)); |
1300 | 1300 |
1301 /* cursor position for other windows with the same buffer */ | 1301 // cursor position for other windows with the same buffer |
1302 if (win != curwin) | 1302 if (win != curwin) |
1303 col_adjust(&win->w_cursor); | 1303 col_adjust(&win->w_cursor); |
1304 } | 1304 } |
1305 } | 1305 } |
1306 } | 1306 } |
1318 int i; | 1318 int i; |
1319 int from, to; | 1319 int from, to; |
1320 | 1320 |
1321 if (loadfiles) | 1321 if (loadfiles) |
1322 { | 1322 { |
1323 /* If specified, load all the files from the jump list. This is | 1323 // If specified, load all the files from the jump list. This is |
1324 * needed to properly clean up duplicate entries, but will take some | 1324 // needed to properly clean up duplicate entries, but will take some |
1325 * time. */ | 1325 // time. |
1326 for (i = 0; i < wp->w_jumplistlen; ++i) | 1326 for (i = 0; i < wp->w_jumplistlen; ++i) |
1327 { | 1327 { |
1328 if ((wp->w_jumplist[i].fmark.fnum == 0) && | 1328 if ((wp->w_jumplist[i].fmark.fnum == 0) && |
1329 (wp->w_jumplist[i].fmark.mark.lnum != 0)) | 1329 (wp->w_jumplist[i].fmark.mark.lnum != 0)) |
1330 fname2fnum(&wp->w_jumplist[i]); | 1330 fname2fnum(&wp->w_jumplist[i]); |
1341 == wp->w_jumplist[from].fmark.fnum | 1341 == wp->w_jumplist[from].fmark.fnum |
1342 && wp->w_jumplist[from].fmark.fnum != 0 | 1342 && wp->w_jumplist[from].fmark.fnum != 0 |
1343 && wp->w_jumplist[i].fmark.mark.lnum | 1343 && wp->w_jumplist[i].fmark.mark.lnum |
1344 == wp->w_jumplist[from].fmark.mark.lnum) | 1344 == wp->w_jumplist[from].fmark.mark.lnum) |
1345 break; | 1345 break; |
1346 if (i >= wp->w_jumplistlen) /* no duplicate */ | 1346 if (i >= wp->w_jumplistlen) // no duplicate |
1347 wp->w_jumplist[to++] = wp->w_jumplist[from]; | 1347 wp->w_jumplist[to++] = wp->w_jumplist[from]; |
1348 else | 1348 else |
1349 vim_free(wp->w_jumplist[from].fname); | 1349 vim_free(wp->w_jumplist[from].fname); |
1350 } | 1350 } |
1351 if (wp->w_jumplistidx == wp->w_jumplistlen) | 1351 if (wp->w_jumplistidx == wp->w_jumplistlen) |
1380 int i; | 1380 int i; |
1381 | 1381 |
1382 for (i = 0; i < wp->w_jumplistlen; ++i) | 1382 for (i = 0; i < wp->w_jumplistlen; ++i) |
1383 vim_free(wp->w_jumplist[i].fname); | 1383 vim_free(wp->w_jumplist[i].fname); |
1384 } | 1384 } |
1385 #endif /* FEAT_JUMPLIST */ | 1385 #endif // FEAT_JUMPLIST |
1386 | 1386 |
1387 void | 1387 void |
1388 set_last_cursor(win_T *win) | 1388 set_last_cursor(win_T *win) |
1389 { | 1389 { |
1390 if (win->w_buffer != NULL) | 1390 if (win->w_buffer != NULL) |