mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 01:46:29 +00: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:
@@ -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_list(rettv->vval.v_list, l);
|
||||||
tv_list_append_number(rettv->vval.v_list, wp->w_jumplistidx);
|
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++) {
|
for (int 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]);
|
|
||||||
}
|
|
||||||
dict_T *const d = tv_dict_alloc();
|
dict_T *const d = tv_dict_alloc();
|
||||||
tv_list_append_dict(l, d);
|
tv_list_append_dict(l, d);
|
||||||
tv_dict_add_nr(d, S_LEN("lnum"), wp->w_jumplist[i].fmark.mark.lnum);
|
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;
|
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;
|
||||||
@@ -463,7 +463,7 @@ getnextmark (
|
|||||||
* This is used for marks obtained from the .shada file. It's postponed
|
* This is used for marks obtained from the .shada file. It's postponed
|
||||||
* until the mark is used to avoid a long startup delay.
|
* 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;
|
char_u *p;
|
||||||
|
|
||||||
@@ -781,13 +781,11 @@ void ex_jumps(exarg_T *eap)
|
|||||||
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"));
|
||||||
for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) {
|
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.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;
|
||||||
@@ -1158,11 +1156,25 @@ void 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.
|
||||||
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 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) {
|
||||||
if (wp->w_jumplistidx == from)
|
if (wp->w_jumplistidx == from)
|
||||||
|
@@ -2739,7 +2739,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer,
|
|||||||
|
|
||||||
// Initialize jump list
|
// Initialize jump list
|
||||||
const void *jump_iter = NULL;
|
const void *jump_iter = NULL;
|
||||||
cleanup_jumplist(curwin);
|
cleanup_jumplist(curwin, false);
|
||||||
setpcmark();
|
setpcmark();
|
||||||
do {
|
do {
|
||||||
xfmark_T fm;
|
xfmark_T fm;
|
||||||
|
Reference in New Issue
Block a user