comparison src/mark.c @ 13278:28ae299c6af0 v8.0.1513

patch 8.0.1513: the jumplist is not always properly cleaned up commit https://github.com/vim/vim/commit/486797413791f6be12dcec6e5faf4f952e4647ae Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 13 13:33:29 2018 +0100 patch 8.0.1513: the jumplist is not always properly cleaned up Problem: The jumplist is not always properly cleaned up. Solution: Call fname2fnum() before cleanup_jumplist(). (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Tue, 13 Feb 2018 13:45:05 +0100
parents 5958573d8a72
children 8a4c0ab88201
comparison
equal deleted inserted replaced
13277:99fc5a0fd96c 13278:28ae299c6af0
219 movemark(int count) 219 movemark(int count)
220 { 220 {
221 pos_T *pos; 221 pos_T *pos;
222 xfmark_T *jmp; 222 xfmark_T *jmp;
223 223
224 cleanup_jumplist(curwin); 224 cleanup_jumplist(curwin, TRUE);
225 225
226 if (curwin->w_jumplistlen == 0) /* nothing to jump to */ 226 if (curwin->w_jumplistlen == 0) /* nothing to jump to */
227 return (pos_T *)NULL; 227 return (pos_T *)NULL;
228 228
229 for (;;) 229 for (;;)
889 ex_jumps(exarg_T *eap UNUSED) 889 ex_jumps(exarg_T *eap UNUSED)
890 { 890 {
891 int i; 891 int i;
892 char_u *name; 892 char_u *name;
893 893
894 cleanup_jumplist(curwin); 894 cleanup_jumplist(curwin, TRUE);
895 895
896 /* Highlight title */ 896 /* Highlight title */
897 MSG_PUTS_TITLE(_("\n jump line col file/text")); 897 MSG_PUTS_TITLE(_("\n jump line col file/text"));
898 for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) 898 for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i)
899 { 899 {
900 if (curwin->w_jumplist[i].fmark.mark.lnum != 0) 900 if (curwin->w_jumplist[i].fmark.mark.lnum != 0)
901 { 901 {
902 if (curwin->w_jumplist[i].fmark.fnum == 0)
903 fname2fnum(&curwin->w_jumplist[i]);
904 name = fm_getname(&curwin->w_jumplist[i].fmark, 16); 902 name = fm_getname(&curwin->w_jumplist[i].fmark, 16);
905 if (name == NULL) /* file name not available */ 903 if (name == NULL) /* file name not available */
906 continue; 904 continue;
907 905
908 msg_putchar('\n'); 906 msg_putchar('\n');
1301 1299
1302 #ifdef FEAT_JUMPLIST 1300 #ifdef FEAT_JUMPLIST
1303 /* 1301 /*
1304 * When deleting lines, this may create duplicate marks in the 1302 * When deleting lines, this may create duplicate marks in the
1305 * jumplist. They will be removed here for the specified window. 1303 * jumplist. They will be removed here for the specified window.
1306 */ 1304 * When "loadfiles" is TRUE first ensure entries have the "fnum" field set
1307 void 1305 * (this may be a bit slow).
1308 cleanup_jumplist(win_T *wp) 1306 */
1307 void
1308 cleanup_jumplist(win_T *wp, int loadfiles)
1309 { 1309 {
1310 int i; 1310 int i;
1311 int from, to; 1311 int from, to;
1312
1313 if (loadfiles)
1314 {
1315 /* If specified, load all the files from the jump list. This is
1316 * needed to properly clean up duplicate entries, but will take some
1317 * time. */
1318 for (i = 0; i < wp->w_jumplistlen; ++i)
1319 {
1320 if ((wp->w_jumplist[i].fmark.fnum == 0) &&
1321 (wp->w_jumplist[i].fmark.mark.lnum != 0))
1322 fname2fnum(&wp->w_jumplist[i]);
1323 }
1324 }
1312 1325
1313 to = 0; 1326 to = 0;
1314 for (from = 0; from < wp->w_jumplistlen; ++from) 1327 for (from = 0; from < wp->w_jumplistlen; ++from)
1315 { 1328 {
1316 if (wp->w_jumplistidx == from) 1329 if (wp->w_jumplistidx == from)
1736 1749
1737 #ifdef FEAT_JUMPLIST 1750 #ifdef FEAT_JUMPLIST
1738 /* Write the jumplist with -' */ 1751 /* Write the jumplist with -' */
1739 fputs(_("\n# Jumplist (newest first):\n"), fp); 1752 fputs(_("\n# Jumplist (newest first):\n"), fp);
1740 setpcmark(); /* add current cursor position */ 1753 setpcmark(); /* add current cursor position */
1741 cleanup_jumplist(curwin); 1754 cleanup_jumplist(curwin, FALSE);
1742 vi_idx = 0; 1755 vi_idx = 0;
1743 idx = curwin->w_jumplistlen - 1; 1756 idx = curwin->w_jumplistlen - 1;
1744 for (i = 0; i < JUMPLISTSIZE; ++i) 1757 for (i = 0; i < JUMPLISTSIZE; ++i)
1745 { 1758 {
1746 xfmark_T *vi_fm; 1759 xfmark_T *vi_fm;