summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2013-06-30 13:57:45 +0200
committerBram Moolenaar <bram@vim.org>2013-06-30 13:57:45 +0200
commitee2163c8a0885852c2fff8ee82c85cada92c824a (patch)
tree96d404c0b2700bd36b449d9828ddac4f0caec21f
parent70048ea6a42a8c2dac0de30403018caa82649245 (diff)
downloadvim-ee2163c8a0885852c2fff8ee82c85cada92c824a.tar.gz
updated for version 7.3.1274v7.3.1274v7-3-1274
Problem: When selecting an entry from a location list it may pick an arbitrary window or open a new one. Solution: Prefer using a window related to the location list. (Lech Lorens)
-rw-r--r--src/quickfix.c40
-rw-r--r--src/version.c2
2 files changed, 27 insertions, 15 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index b11ddd25..f7897850 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -1616,6 +1616,8 @@ qf_jump(qi, dir, errornr, forceit)
*/
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.
@@ -1623,14 +1625,29 @@ qf_jump(qi, dir, errornr, forceit)
if (qf_ptr->qf_fnum == 0)
goto theend;
- /* Locate a window showing a normal buffer */
usable_win = 0;
- FOR_ALL_WINDOWS(win)
- if (win->w_buffer->b_p_bt[0] == NUL)
- {
- usable_win = 1;
- break;
- }
+
+ ll_ref = curwin->w_llist_ref;
+ if (ll_ref != NULL)
+ {
+ /* Find a window using the same location list that is not a
+ * quickfix window. */
+ FOR_ALL_WINDOWS(usable_win_ptr)
+ if (usable_win_ptr->w_llist == ll_ref
+ && usable_win_ptr->w_buffer->b_p_bt[0] != 'q')
+ break;
+ }
+
+ if (!usable_win)
+ {
+ /* Locate a window showing a normal buffer */
+ FOR_ALL_WINDOWS(win)
+ if (win->w_buffer->b_p_bt[0] == NUL)
+ {
+ usable_win = 1;
+ break;
+ }
+ }
/*
* If no usable window is found and 'switchbuf' contains "usetab"
@@ -1659,8 +1676,6 @@ win_found:
*/
if (((firstwin == lastwin) && bt_quickfix(curbuf)) || !usable_win)
{
- ll_ref = curwin->w_llist_ref;
-
flags = WSP_ABOVE;
if (ll_ref != NULL)
flags |= WSP_NEWLOC;
@@ -1683,12 +1698,7 @@ win_found:
if (curwin->w_llist_ref != NULL)
{
/* In a location window */
- ll_ref = curwin->w_llist_ref;
-
- /* Find the window with the same location list */
- FOR_ALL_WINDOWS(win)
- if (win->w_llist == ll_ref)
- break;
+ win = usable_win_ptr;
if (win == NULL)
{
/* Find the window showing the selected file */
diff --git a/src/version.c b/src/version.c
index ea90de9c..99c54b7f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1274,
+/**/
1273,
/**/
1272,