forked from aniani/vim
patch 8.0.1130: the qf_jump() function is still too long
Problem: The qf_jump() function is still too long. Solution: Split of parts to separate functions. (Yegappan Lakshmanan)
This commit is contained in:
350
src/quickfix.c
350
src/quickfix.c
@@ -1954,8 +1954,7 @@ is_qf_entry_present(qf_info_T *qi, qfline_T *qf_ptr)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the next valid entry in the current quickfix/location list. The search
|
* Get the next valid entry in the current quickfix/location list. The search
|
||||||
* starts from the current entry. If next_file is TRUE, then return the next
|
* starts from the current entry. Returns NULL on failure.
|
||||||
* valid entry in the next file in the list. Returns NULL on failure.
|
|
||||||
*/
|
*/
|
||||||
static qfline_T *
|
static qfline_T *
|
||||||
get_next_valid_entry(
|
get_next_valid_entry(
|
||||||
@@ -1987,9 +1986,7 @@ get_next_valid_entry(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the previous valid entry in the current quickfix/location list. The
|
* Get the previous valid entry in the current quickfix/location list. The
|
||||||
* search starts from the current entry. If prev_file is TRUE, then return the
|
* search starts from the current entry. Returns NULL on failure.
|
||||||
* previous valid entry in the previous file in the list. Returns NULL on
|
|
||||||
* failure.
|
|
||||||
*/
|
*/
|
||||||
static qfline_T *
|
static qfline_T *
|
||||||
get_prev_valid_entry(
|
get_prev_valid_entry(
|
||||||
@@ -2065,22 +2062,24 @@ get_nth_valid_entry(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get n'th quickfix entry
|
* Get n'th (errornr) quickfix entry
|
||||||
*/
|
*/
|
||||||
static qfline_T *
|
static qfline_T *
|
||||||
get_nth_entry(
|
get_nth_entry(
|
||||||
qf_info_T *qi,
|
qf_info_T *qi,
|
||||||
int errornr,
|
int errornr,
|
||||||
qfline_T *qf_ptr,
|
qfline_T *qf_ptr,
|
||||||
int *qf_index)
|
int *cur_qfidx)
|
||||||
{
|
{
|
||||||
int qf_idx = *qf_index;
|
int qf_idx = *cur_qfidx;
|
||||||
|
|
||||||
|
/* New error number is less than the current error number */
|
||||||
while (errornr < qf_idx && qf_idx > 1 && qf_ptr->qf_prev != NULL)
|
while (errornr < qf_idx && qf_idx > 1 && qf_ptr->qf_prev != NULL)
|
||||||
{
|
{
|
||||||
--qf_idx;
|
--qf_idx;
|
||||||
qf_ptr = qf_ptr->qf_prev;
|
qf_ptr = qf_ptr->qf_prev;
|
||||||
}
|
}
|
||||||
|
/* New error number is greater than the current error number */
|
||||||
while (errornr > qf_idx &&
|
while (errornr > qf_idx &&
|
||||||
qf_idx < qi->qf_lists[qi->qf_curlist].qf_count &&
|
qf_idx < qi->qf_lists[qi->qf_curlist].qf_count &&
|
||||||
qf_ptr->qf_next != NULL)
|
qf_ptr->qf_next != NULL)
|
||||||
@@ -2089,7 +2088,7 @@ get_nth_entry(
|
|||||||
qf_ptr = qf_ptr->qf_next;
|
qf_ptr = qf_ptr->qf_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
*qf_index = qf_idx;
|
*cur_qfidx = qf_idx;
|
||||||
return qf_ptr;
|
return qf_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2146,102 +2145,18 @@ jump_to_help_window(qf_info_T *qi, int *opened_window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* jump to a quickfix line
|
* Find a suitable window for opening a file (qf_fnum) and jump to it.
|
||||||
* if dir == FORWARD go "errornr" valid entries forward
|
* If the file is already opened in a window, jump to it.
|
||||||
* if dir == BACKWARD go "errornr" valid entries backward
|
|
||||||
* if dir == FORWARD_FILE go "errornr" valid entries files backward
|
|
||||||
* if dir == BACKWARD_FILE go "errornr" valid entries files backward
|
|
||||||
* else if "errornr" is zero, redisplay the same line
|
|
||||||
* else go to entry "errornr"
|
|
||||||
*/
|
*/
|
||||||
void
|
static int
|
||||||
qf_jump(qf_info_T *qi,
|
qf_jump_to_usable_window(int qf_fnum, int *opened_window)
|
||||||
int dir,
|
|
||||||
int errornr,
|
|
||||||
int forceit)
|
|
||||||
{
|
{
|
||||||
|
win_T *usable_win_ptr = NULL;
|
||||||
|
int usable_win;
|
||||||
qf_info_T *ll_ref;
|
qf_info_T *ll_ref;
|
||||||
qfline_T *qf_ptr;
|
int flags;
|
||||||
qfline_T *old_qf_ptr;
|
|
||||||
int qf_index;
|
|
||||||
int old_qf_index;
|
|
||||||
linenr_T i;
|
|
||||||
buf_T *old_curbuf;
|
|
||||||
linenr_T old_lnum;
|
|
||||||
colnr_T screen_col;
|
|
||||||
colnr_T char_col;
|
|
||||||
char_u *line;
|
|
||||||
char_u *old_swb = p_swb;
|
|
||||||
unsigned old_swb_flags = swb_flags;
|
|
||||||
int opened_window = FALSE;
|
|
||||||
win_T *win;
|
win_T *win;
|
||||||
win_T *altwin;
|
win_T *altwin;
|
||||||
int flags;
|
|
||||||
win_T *oldwin = curwin;
|
|
||||||
int print_message = TRUE;
|
|
||||||
int len;
|
|
||||||
#ifdef FEAT_FOLDING
|
|
||||||
int old_KeyTyped = KeyTyped; /* getting file may reset it */
|
|
||||||
#endif
|
|
||||||
int ok = OK;
|
|
||||||
int usable_win;
|
|
||||||
|
|
||||||
if (qi == NULL)
|
|
||||||
qi = &ql_info;
|
|
||||||
|
|
||||||
if (qi->qf_curlist >= qi->qf_listcount
|
|
||||||
|| qi->qf_lists[qi->qf_curlist].qf_count == 0)
|
|
||||||
{
|
|
||||||
EMSG(_(e_quickfix));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
qf_ptr = qi->qf_lists[qi->qf_curlist].qf_ptr;
|
|
||||||
old_qf_ptr = qf_ptr;
|
|
||||||
qf_index = qi->qf_lists[qi->qf_curlist].qf_index;
|
|
||||||
old_qf_index = qf_index;
|
|
||||||
if (dir != 0) /* next/prev valid entry */
|
|
||||||
{
|
|
||||||
qf_ptr = get_nth_valid_entry(qi, errornr, qf_ptr, &qf_index, dir);
|
|
||||||
if (qf_ptr == NULL)
|
|
||||||
{
|
|
||||||
qf_ptr = old_qf_ptr;
|
|
||||||
qf_index = old_qf_index;
|
|
||||||
goto theend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (errornr != 0) /* go to specified number */
|
|
||||||
qf_ptr = get_nth_entry(qi, errornr, qf_ptr, &qf_index);
|
|
||||||
|
|
||||||
qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
|
|
||||||
if (qf_win_pos_update(qi, old_qf_index))
|
|
||||||
/* No need to print the error message if it's visible in the error
|
|
||||||
* window */
|
|
||||||
print_message = FALSE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For ":helpgrep" find a help window or open one.
|
|
||||||
*/
|
|
||||||
if (qf_ptr->qf_type == 1 && (!bt_help(curwin->w_buffer) || cmdmod.tab != 0))
|
|
||||||
{
|
|
||||||
if (jump_to_help_window(qi, &opened_window) == FAIL)
|
|
||||||
goto theend;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If currently in the quickfix window, find another window to show the
|
|
||||||
* file in.
|
|
||||||
*/
|
|
||||||
if (bt_quickfix(curbuf) && !opened_window)
|
|
||||||
{
|
|
||||||
win_T *usable_win_ptr = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If there is no file specified, we don't know where to go.
|
|
||||||
* But do advance, otherwise ":cn" gets stuck.
|
|
||||||
*/
|
|
||||||
if (qf_ptr->qf_fnum == 0)
|
|
||||||
goto theend;
|
|
||||||
|
|
||||||
usable_win = 0;
|
usable_win = 0;
|
||||||
|
|
||||||
@@ -2281,7 +2196,7 @@ qf_jump(qf_info_T *qi,
|
|||||||
|
|
||||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||||
{
|
{
|
||||||
if (wp->w_buffer->b_fnum == qf_ptr->qf_fnum)
|
if (wp->w_buffer->b_fnum == qf_fnum)
|
||||||
{
|
{
|
||||||
goto_tabpage_win(tp, wp);
|
goto_tabpage_win(tp, wp);
|
||||||
usable_win = 1;
|
usable_win = 1;
|
||||||
@@ -2301,8 +2216,8 @@ win_found:
|
|||||||
if (ll_ref != NULL)
|
if (ll_ref != NULL)
|
||||||
flags |= WSP_NEWLOC;
|
flags |= WSP_NEWLOC;
|
||||||
if (win_split(0, flags) == FAIL)
|
if (win_split(0, flags) == FAIL)
|
||||||
goto failed; /* not enough room for window */
|
return FAIL; /* not enough room for window */
|
||||||
opened_window = TRUE; /* close it when fail */
|
*opened_window = TRUE; /* close it when fail */
|
||||||
p_swb = empty_option; /* don't split again */
|
p_swb = empty_option; /* don't split again */
|
||||||
swb_flags = 0;
|
swb_flags = 0;
|
||||||
RESET_BINDING(curwin);
|
RESET_BINDING(curwin);
|
||||||
@@ -2324,7 +2239,7 @@ win_found:
|
|||||||
{
|
{
|
||||||
/* Find the window showing the selected file */
|
/* Find the window showing the selected file */
|
||||||
FOR_ALL_WINDOWS(win)
|
FOR_ALL_WINDOWS(win)
|
||||||
if (win->w_buffer->b_fnum == qf_ptr->qf_fnum)
|
if (win->w_buffer->b_fnum == qf_fnum)
|
||||||
break;
|
break;
|
||||||
if (win == NULL)
|
if (win == NULL)
|
||||||
{
|
{
|
||||||
@@ -2362,7 +2277,7 @@ win_found:
|
|||||||
altwin = NULL;
|
altwin = NULL;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (win->w_buffer->b_fnum == qf_ptr->qf_fnum)
|
if (win->w_buffer->b_fnum == qf_fnum)
|
||||||
break;
|
break;
|
||||||
if (win->w_prev == NULL)
|
if (win->w_prev == NULL)
|
||||||
win = lastwin; /* wrap around the top */
|
win = lastwin; /* wrap around the top */
|
||||||
@@ -2391,17 +2306,24 @@ win_found:
|
|||||||
win_goto(win);
|
win_goto(win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
return OK;
|
||||||
* If there is a file name,
|
}
|
||||||
* read the wanted file if needed, and check autowrite etc.
|
|
||||||
|
/*
|
||||||
|
* Edit the selected file or help file.
|
||||||
*/
|
*/
|
||||||
old_curbuf = curbuf;
|
static int
|
||||||
old_lnum = curwin->w_cursor.lnum;
|
qf_jump_edit_buffer(
|
||||||
|
qf_info_T *qi,
|
||||||
|
qfline_T *qf_ptr,
|
||||||
|
int forceit,
|
||||||
|
win_T *oldwin,
|
||||||
|
int *opened_window,
|
||||||
|
int *abort)
|
||||||
|
{
|
||||||
|
int retval = OK;
|
||||||
|
|
||||||
if (qf_ptr->qf_fnum != 0)
|
|
||||||
{
|
|
||||||
if (qf_ptr->qf_type == 1)
|
if (qf_ptr->qf_type == 1)
|
||||||
{
|
{
|
||||||
/* Open help file (do_ecmd() will set b_help flag, readfile() will
|
/* Open help file (do_ecmd() will set b_help flag, readfile() will
|
||||||
@@ -2409,25 +2331,24 @@ win_found:
|
|||||||
if (!can_abandon(curbuf, forceit))
|
if (!can_abandon(curbuf, forceit))
|
||||||
{
|
{
|
||||||
no_write_message();
|
no_write_message();
|
||||||
ok = FALSE;
|
retval = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ok = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1,
|
retval = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1,
|
||||||
ECMD_HIDE + ECMD_SET_HELP,
|
ECMD_HIDE + ECMD_SET_HELP,
|
||||||
oldwin == curwin ? curwin : NULL);
|
oldwin == curwin ? curwin : NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int old_qf_curlist = qi->qf_curlist;
|
int old_qf_curlist = qi->qf_curlist;
|
||||||
int is_abort = FALSE;
|
|
||||||
|
|
||||||
ok = buflist_getfile(qf_ptr->qf_fnum,
|
retval = buflist_getfile(qf_ptr->qf_fnum,
|
||||||
(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
|
(linenr_T)1, GETF_SETMARK | GETF_SWITCH, forceit);
|
||||||
if (qi != &ql_info && !win_valid_any_tab(oldwin))
|
if (qi != &ql_info && !win_valid_any_tab(oldwin))
|
||||||
{
|
{
|
||||||
EMSG(_("E924: Current window was closed"));
|
EMSG(_("E924: Current window was closed"));
|
||||||
is_abort = TRUE;
|
*abort = TRUE;
|
||||||
opened_window = FALSE;
|
*opened_window = FALSE;
|
||||||
}
|
}
|
||||||
else if (old_qf_curlist != qi->qf_curlist
|
else if (old_qf_curlist != qi->qf_curlist
|
||||||
|| !is_qf_entry_present(qi, qf_ptr))
|
|| !is_qf_entry_present(qi, qf_ptr))
|
||||||
@@ -2436,43 +2357,51 @@ win_found:
|
|||||||
EMSG(_("E925: Current quickfix was changed"));
|
EMSG(_("E925: Current quickfix was changed"));
|
||||||
else
|
else
|
||||||
EMSG(_("E926: Current location list was changed"));
|
EMSG(_("E926: Current location list was changed"));
|
||||||
is_abort = TRUE;
|
*abort = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_abort)
|
if (*abort)
|
||||||
{
|
retval = FALSE;
|
||||||
ok = FALSE;
|
|
||||||
qi = NULL;
|
|
||||||
qf_ptr = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok == OK)
|
return retval;
|
||||||
{
|
}
|
||||||
/* When not switched to another buffer, still need to set pc mark */
|
|
||||||
if (curbuf == old_curbuf)
|
|
||||||
setpcmark();
|
|
||||||
|
|
||||||
if (qf_ptr->qf_pattern == NULL)
|
/*
|
||||||
|
* Goto the error line in the current file using either line/column number or a
|
||||||
|
* search pattern.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
qf_jump_goto_line(
|
||||||
|
linenr_T qf_lnum,
|
||||||
|
int qf_col,
|
||||||
|
char_u qf_viscol,
|
||||||
|
char_u *qf_pattern)
|
||||||
|
{
|
||||||
|
linenr_T i;
|
||||||
|
char_u *line;
|
||||||
|
colnr_T screen_col;
|
||||||
|
colnr_T char_col;
|
||||||
|
|
||||||
|
if (qf_pattern == NULL)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Go to line with error, unless qf_lnum is 0.
|
* Go to line with error, unless qf_lnum is 0.
|
||||||
*/
|
*/
|
||||||
i = qf_ptr->qf_lnum;
|
i = qf_lnum;
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
if (i > curbuf->b_ml.ml_line_count)
|
if (i > curbuf->b_ml.ml_line_count)
|
||||||
i = curbuf->b_ml.ml_line_count;
|
i = curbuf->b_ml.ml_line_count;
|
||||||
curwin->w_cursor.lnum = i;
|
curwin->w_cursor.lnum = i;
|
||||||
}
|
}
|
||||||
if (qf_ptr->qf_col > 0)
|
if (qf_col > 0)
|
||||||
{
|
{
|
||||||
curwin->w_cursor.col = qf_ptr->qf_col - 1;
|
curwin->w_cursor.col = qf_col - 1;
|
||||||
#ifdef FEAT_VIRTUALEDIT
|
#ifdef FEAT_VIRTUALEDIT
|
||||||
curwin->w_cursor.coladd = 0;
|
curwin->w_cursor.coladd = 0;
|
||||||
#endif
|
#endif
|
||||||
if (qf_ptr->qf_viscol == TRUE)
|
if (qf_viscol == TRUE)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Check each character from the beginning of the error
|
* Check each character from the beginning of the error
|
||||||
@@ -2507,17 +2436,26 @@ win_found:
|
|||||||
/* Move the cursor to the first line in the buffer */
|
/* Move the cursor to the first line in the buffer */
|
||||||
save_cursor = curwin->w_cursor;
|
save_cursor = curwin->w_cursor;
|
||||||
curwin->w_cursor.lnum = 0;
|
curwin->w_cursor.lnum = 0;
|
||||||
if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1,
|
if (!do_search(NULL, '/', qf_pattern, (long)1,
|
||||||
SEARCH_KEEP, NULL, NULL))
|
SEARCH_KEEP, NULL, NULL))
|
||||||
curwin->w_cursor = save_cursor;
|
curwin->w_cursor = save_cursor;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Display quickfix list index and size message
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
qf_jump_print_msg(
|
||||||
|
qf_info_T *qi,
|
||||||
|
int qf_index,
|
||||||
|
qfline_T *qf_ptr,
|
||||||
|
buf_T *old_curbuf,
|
||||||
|
linenr_T old_lnum)
|
||||||
|
{
|
||||||
|
linenr_T i;
|
||||||
|
int len;
|
||||||
|
|
||||||
#ifdef FEAT_FOLDING
|
|
||||||
if ((fdo_flags & FDO_QUICKFIX) && old_KeyTyped)
|
|
||||||
foldOpenCursor();
|
|
||||||
#endif
|
|
||||||
if (print_message)
|
|
||||||
{
|
|
||||||
/* Update the screen before showing the message, unless the screen
|
/* Update the screen before showing the message, unless the screen
|
||||||
* scrolled up. */
|
* scrolled up. */
|
||||||
if (!msg_scrolled)
|
if (!msg_scrolled)
|
||||||
@@ -2540,7 +2478,131 @@ win_found:
|
|||||||
msg_scroll = FALSE;
|
msg_scroll = FALSE;
|
||||||
msg_attr_keep(IObuff, 0, TRUE);
|
msg_attr_keep(IObuff, 0, TRUE);
|
||||||
msg_scroll = i;
|
msg_scroll = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* jump to a quickfix line
|
||||||
|
* if dir == FORWARD go "errornr" valid entries forward
|
||||||
|
* if dir == BACKWARD go "errornr" valid entries backward
|
||||||
|
* if dir == FORWARD_FILE go "errornr" valid entries files backward
|
||||||
|
* if dir == BACKWARD_FILE go "errornr" valid entries files backward
|
||||||
|
* else if "errornr" is zero, redisplay the same line
|
||||||
|
* else go to entry "errornr"
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
qf_jump(qf_info_T *qi,
|
||||||
|
int dir,
|
||||||
|
int errornr,
|
||||||
|
int forceit)
|
||||||
|
{
|
||||||
|
qfline_T *qf_ptr;
|
||||||
|
qfline_T *old_qf_ptr;
|
||||||
|
int qf_index;
|
||||||
|
int old_qf_index;
|
||||||
|
buf_T *old_curbuf;
|
||||||
|
linenr_T old_lnum;
|
||||||
|
char_u *old_swb = p_swb;
|
||||||
|
unsigned old_swb_flags = swb_flags;
|
||||||
|
int opened_window = FALSE;
|
||||||
|
win_T *oldwin = curwin;
|
||||||
|
int print_message = TRUE;
|
||||||
|
#ifdef FEAT_FOLDING
|
||||||
|
int old_KeyTyped = KeyTyped; /* getting file may reset it */
|
||||||
|
#endif
|
||||||
|
int retval = OK;
|
||||||
|
|
||||||
|
if (qi == NULL)
|
||||||
|
qi = &ql_info;
|
||||||
|
|
||||||
|
if (qi->qf_curlist >= qi->qf_listcount
|
||||||
|
|| qi->qf_lists[qi->qf_curlist].qf_count == 0)
|
||||||
|
{
|
||||||
|
EMSG(_(e_quickfix));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qf_ptr = qi->qf_lists[qi->qf_curlist].qf_ptr;
|
||||||
|
old_qf_ptr = qf_ptr;
|
||||||
|
qf_index = qi->qf_lists[qi->qf_curlist].qf_index;
|
||||||
|
old_qf_index = qf_index;
|
||||||
|
if (dir != 0) /* next/prev valid entry */
|
||||||
|
{
|
||||||
|
qf_ptr = get_nth_valid_entry(qi, errornr, qf_ptr, &qf_index, dir);
|
||||||
|
if (qf_ptr == NULL)
|
||||||
|
{
|
||||||
|
qf_ptr = old_qf_ptr;
|
||||||
|
qf_index = old_qf_index;
|
||||||
|
goto theend;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (errornr != 0) /* go to specified number */
|
||||||
|
qf_ptr = get_nth_entry(qi, errornr, qf_ptr, &qf_index);
|
||||||
|
|
||||||
|
qi->qf_lists[qi->qf_curlist].qf_index = qf_index;
|
||||||
|
if (qf_win_pos_update(qi, old_qf_index))
|
||||||
|
/* No need to print the error message if it's visible in the error
|
||||||
|
* window */
|
||||||
|
print_message = FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For ":helpgrep" find a help window or open one.
|
||||||
|
*/
|
||||||
|
if (qf_ptr->qf_type == 1 && (!bt_help(curwin->w_buffer) || cmdmod.tab != 0))
|
||||||
|
if (jump_to_help_window(qi, &opened_window) == FAIL)
|
||||||
|
goto theend;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If currently in the quickfix window, find another window to show the
|
||||||
|
* file in.
|
||||||
|
*/
|
||||||
|
if (bt_quickfix(curbuf) && !opened_window)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* If there is no file specified, we don't know where to go.
|
||||||
|
* But do advance, otherwise ":cn" gets stuck.
|
||||||
|
*/
|
||||||
|
if (qf_ptr->qf_fnum == 0)
|
||||||
|
goto theend;
|
||||||
|
|
||||||
|
if (qf_jump_to_usable_window(qf_ptr->qf_fnum, &opened_window) == FAIL)
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If there is a file name,
|
||||||
|
* read the wanted file if needed, and check autowrite etc.
|
||||||
|
*/
|
||||||
|
old_curbuf = curbuf;
|
||||||
|
old_lnum = curwin->w_cursor.lnum;
|
||||||
|
|
||||||
|
if (qf_ptr->qf_fnum != 0)
|
||||||
|
{
|
||||||
|
int abort = FALSE;
|
||||||
|
|
||||||
|
retval = qf_jump_edit_buffer(qi, qf_ptr, forceit, oldwin,
|
||||||
|
&opened_window, &abort);
|
||||||
|
if (abort)
|
||||||
|
{
|
||||||
|
qi = NULL;
|
||||||
|
qf_ptr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retval == OK)
|
||||||
|
{
|
||||||
|
/* When not switched to another buffer, still need to set pc mark */
|
||||||
|
if (curbuf == old_curbuf)
|
||||||
|
setpcmark();
|
||||||
|
|
||||||
|
qf_jump_goto_line(qf_ptr->qf_lnum, qf_ptr->qf_col, qf_ptr->qf_viscol,
|
||||||
|
qf_ptr->qf_pattern);
|
||||||
|
|
||||||
|
#ifdef FEAT_FOLDING
|
||||||
|
if ((fdo_flags & FDO_QUICKFIX) && old_KeyTyped)
|
||||||
|
foldOpenCursor();
|
||||||
|
#endif
|
||||||
|
if (print_message)
|
||||||
|
qf_jump_print_msg(qi, qf_index, qf_ptr, old_curbuf, old_lnum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -761,6 +761,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 */
|
||||||
|
/**/
|
||||||
|
1130,
|
||||||
/**/
|
/**/
|
||||||
1129,
|
1129,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user