mirror of
https://github.com/vim/vim.git
synced 2025-10-12 06:44:06 -04:00
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)
This commit is contained in:
@@ -4858,13 +4858,12 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
|
|||||||
return;
|
return;
|
||||||
list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx);
|
list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx);
|
||||||
|
|
||||||
cleanup_jumplist(wp);
|
cleanup_jumplist(wp, TRUE);
|
||||||
|
|
||||||
for (i = 0; i < wp->w_jumplistlen; ++i)
|
for (i = 0; i < wp->w_jumplistlen; ++i)
|
||||||
{
|
{
|
||||||
if (wp->w_jumplist[i].fmark.mark.lnum == 0)
|
if (wp->w_jumplist[i].fmark.mark.lnum == 0)
|
||||||
continue;
|
continue;
|
||||||
if (wp->w_jumplist[i].fmark.fnum == 0)
|
|
||||||
fname2fnum(&wp->w_jumplist[i]);
|
|
||||||
if ((d = dict_alloc()) == NULL)
|
if ((d = dict_alloc()) == NULL)
|
||||||
return;
|
return;
|
||||||
if (list_append_dict(l, d) == FAIL)
|
if (list_append_dict(l, d) == FAIL)
|
||||||
|
25
src/mark.c
25
src/mark.c
@@ -221,7 +221,7 @@ movemark(int count)
|
|||||||
pos_T *pos;
|
pos_T *pos;
|
||||||
xfmark_T *jmp;
|
xfmark_T *jmp;
|
||||||
|
|
||||||
cleanup_jumplist(curwin);
|
cleanup_jumplist(curwin, TRUE);
|
||||||
|
|
||||||
if (curwin->w_jumplistlen == 0) /* nothing to jump to */
|
if (curwin->w_jumplistlen == 0) /* nothing to jump to */
|
||||||
return (pos_T *)NULL;
|
return (pos_T *)NULL;
|
||||||
@@ -891,7 +891,7 @@ ex_jumps(exarg_T *eap UNUSED)
|
|||||||
int i;
|
int i;
|
||||||
char_u *name;
|
char_u *name;
|
||||||
|
|
||||||
cleanup_jumplist(curwin);
|
cleanup_jumplist(curwin, TRUE);
|
||||||
|
|
||||||
/* Highlight title */
|
/* Highlight title */
|
||||||
MSG_PUTS_TITLE(_("\n jump line col file/text"));
|
MSG_PUTS_TITLE(_("\n jump line col file/text"));
|
||||||
@@ -899,8 +899,6 @@ ex_jumps(exarg_T *eap UNUSED)
|
|||||||
{
|
{
|
||||||
if (curwin->w_jumplist[i].fmark.mark.lnum != 0)
|
if (curwin->w_jumplist[i].fmark.mark.lnum != 0)
|
||||||
{
|
{
|
||||||
if (curwin->w_jumplist[i].fmark.fnum == 0)
|
|
||||||
fname2fnum(&curwin->w_jumplist[i]);
|
|
||||||
name = fm_getname(&curwin->w_jumplist[i].fmark, 16);
|
name = fm_getname(&curwin->w_jumplist[i].fmark, 16);
|
||||||
if (name == NULL) /* file name not available */
|
if (name == NULL) /* file name not available */
|
||||||
continue;
|
continue;
|
||||||
@@ -1303,13 +1301,28 @@ mark_col_adjust(
|
|||||||
/*
|
/*
|
||||||
* When deleting lines, this may create duplicate marks in the
|
* When deleting lines, this may create duplicate marks in the
|
||||||
* jumplist. They will be removed here for the specified window.
|
* jumplist. They will be removed here for the specified window.
|
||||||
|
* When "loadfiles" is TRUE first ensure entries have the "fnum" field set
|
||||||
|
* (this may be a bit slow).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
cleanup_jumplist(win_T *wp)
|
cleanup_jumplist(win_T *wp, int loadfiles)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int from, to;
|
int from, to;
|
||||||
|
|
||||||
|
if (loadfiles)
|
||||||
|
{
|
||||||
|
/* If specified, load all the files from the jump list. This is
|
||||||
|
* needed to properly clean up duplicate entries, but will take some
|
||||||
|
* time. */
|
||||||
|
for (i = 0; i < wp->w_jumplistlen; ++i)
|
||||||
|
{
|
||||||
|
if ((wp->w_jumplist[i].fmark.fnum == 0) &&
|
||||||
|
(wp->w_jumplist[i].fmark.mark.lnum != 0))
|
||||||
|
fname2fnum(&wp->w_jumplist[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
to = 0;
|
to = 0;
|
||||||
for (from = 0; from < wp->w_jumplistlen; ++from)
|
for (from = 0; from < wp->w_jumplistlen; ++from)
|
||||||
{
|
{
|
||||||
@@ -1738,7 +1751,7 @@ write_viminfo_filemarks(FILE *fp)
|
|||||||
/* Write the jumplist with -' */
|
/* Write the jumplist with -' */
|
||||||
fputs(_("\n# Jumplist (newest first):\n"), fp);
|
fputs(_("\n# Jumplist (newest first):\n"), fp);
|
||||||
setpcmark(); /* add current cursor position */
|
setpcmark(); /* add current cursor position */
|
||||||
cleanup_jumplist(curwin);
|
cleanup_jumplist(curwin, FALSE);
|
||||||
vi_idx = 0;
|
vi_idx = 0;
|
||||||
idx = curwin->w_jumplistlen - 1;
|
idx = curwin->w_jumplistlen - 1;
|
||||||
for (i = 0; i < JUMPLISTSIZE; ++i)
|
for (i = 0; i < JUMPLISTSIZE; ++i)
|
||||||
|
@@ -24,7 +24,7 @@ void mark_adjust_nofold(linenr_T line1, linenr_T line2, long amount, long amount
|
|||||||
void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount);
|
void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount);
|
||||||
void copy_jumplist(win_T *from, win_T *to);
|
void copy_jumplist(win_T *from, win_T *to);
|
||||||
void free_jumplist(win_T *wp);
|
void free_jumplist(win_T *wp);
|
||||||
void cleanup_jumplist(win_T *wp);
|
void cleanup_jumplist(win_T *wp, int loadfiles);
|
||||||
void set_last_cursor(win_T *win);
|
void set_last_cursor(win_T *win);
|
||||||
void free_all_marks(void);
|
void free_all_marks(void);
|
||||||
int read_viminfo_filemark(vir_T *virp, int force);
|
int read_viminfo_filemark(vir_T *virp, int force);
|
||||||
|
@@ -771,6 +771,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1513,
|
||||||
/**/
|
/**/
|
||||||
1512,
|
1512,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user