mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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)
4867974137
This commit is contained in:
parent
d6d9596b38
commit
4aad4c0533
@ -10064,14 +10064,12 @@ static void f_getjumplist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
tv_list_append_list(rettv->vval.v_list, l);
|
||||
tv_list_append_number(rettv->vval.v_list, wp->w_jumplistidx);
|
||||
|
||||
cleanup_jumplist(wp);
|
||||
cleanup_jumplist(wp, true);
|
||||
|
||||
for (int i = 0; i < wp->w_jumplistlen; i++) {
|
||||
if (wp->w_jumplist[i].fmark.mark.lnum == 0) {
|
||||
continue;
|
||||
}
|
||||
if (wp->w_jumplist[i].fmark.fnum == 0) {
|
||||
fname2fnum(&wp->w_jumplist[i]);
|
||||
}
|
||||
dict_T *const d = tv_dict_alloc();
|
||||
tv_list_append_dict(l, d);
|
||||
tv_dict_add_nr(d, S_LEN("lnum"), wp->w_jumplist[i].fmark.mark.lnum);
|
||||
|
@ -214,7 +214,7 @@ pos_T *movemark(int count)
|
||||
pos_T *pos;
|
||||
xfmark_T *jmp;
|
||||
|
||||
cleanup_jumplist(curwin);
|
||||
cleanup_jumplist(curwin, true);
|
||||
|
||||
if (curwin->w_jumplistlen == 0) /* nothing to jump to */
|
||||
return (pos_T *)NULL;
|
||||
@ -463,7 +463,7 @@ getnextmark (
|
||||
* This is used for marks obtained from the .shada file. It's postponed
|
||||
* until the mark is used to avoid a long startup delay.
|
||||
*/
|
||||
void fname2fnum(xfmark_T *fm)
|
||||
static void fname2fnum(xfmark_T *fm)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@ -781,13 +781,11 @@ void ex_jumps(exarg_T *eap)
|
||||
int i;
|
||||
char_u *name;
|
||||
|
||||
cleanup_jumplist(curwin);
|
||||
cleanup_jumplist(curwin, true);
|
||||
/* Highlight title */
|
||||
MSG_PUTS_TITLE(_("\n jump line col file/text"));
|
||||
for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) {
|
||||
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);
|
||||
if (name == NULL) /* file name not available */
|
||||
continue;
|
||||
@ -1158,11 +1156,25 @@ void mark_col_adjust(
|
||||
|
||||
// When deleting lines, this may create duplicate marks in the
|
||||
// jumplist. They will be removed here for the specified window.
|
||||
void cleanup_jumplist(win_T *wp)
|
||||
// When "loadfiles" is true first ensure entries have the "fnum" field set
|
||||
// (this may be a bit slow).
|
||||
void cleanup_jumplist(win_T *wp, bool loadfiles)
|
||||
{
|
||||
int i;
|
||||
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;
|
||||
for (from = 0; from < wp->w_jumplistlen; ++from) {
|
||||
if (wp->w_jumplistidx == from)
|
||||
|
@ -2739,7 +2739,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
|
||||
|
||||
// Initialize jump list
|
||||
const void *jump_iter = NULL;
|
||||
cleanup_jumplist(curwin);
|
||||
cleanup_jumplist(curwin, false);
|
||||
setpcmark();
|
||||
do {
|
||||
xfmark_T fm;
|
||||
|
Loading…
Reference in New Issue
Block a user