summaryrefslogtreecommitdiff
path: root/src/quickfix.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-18 22:02:16 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-18 22:02:16 +0100
commitf9ae154c512683ea7b933f870b0268232fd7ad38 (patch)
treecc097b3542a2b55896c6b3af771dc40b31c0c9b2 /src/quickfix.c
parent07a63d86338476bafbd1a3ec462672df92666498 (diff)
downloadvim-git-f9ae154c512683ea7b933f870b0268232fd7ad38.tar.gz
patch 8.1.2320: insufficient test coverage for quickfixv8.1.2320
Problem: Insufficient test coverage for quickfix. Solution: Add more tests. Fix uncovered problem. (Yegappan Lakshmanan, closes #5238)
Diffstat (limited to 'src/quickfix.c')
-rw-r--r--src/quickfix.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/quickfix.c b/src/quickfix.c
index aa4e76590..e58318a3b 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -3044,12 +3044,9 @@ qf_goto_win_with_qfl_file(int qf_fnum)
static int
qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window)
{
- win_T *usable_win_ptr = NULL;
- int usable_win;
+ win_T *usable_wp = NULL;
+ int usable_win = FALSE;
qf_info_T *ll_ref = NULL;
- win_T *win;
-
- usable_win = 0;
// If opening a new window, then don't use the location list referred by
// the current window. Otherwise two windows will refer to the same
@@ -3060,17 +3057,17 @@ qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window)
if (ll_ref != NULL)
{
// Find a non-quickfix window with this location list
- usable_win_ptr = qf_find_win_with_loclist(ll_ref);
- if (usable_win_ptr != NULL)
- usable_win = 1;
+ usable_wp = qf_find_win_with_loclist(ll_ref);
+ if (usable_wp != NULL)
+ usable_win = TRUE;
}
if (!usable_win)
{
// Locate a window showing a normal buffer
- win = qf_find_win_with_normal_buf();
+ win_T *win = qf_find_win_with_normal_buf();
if (win != NULL)
- usable_win = 1;
+ usable_win = TRUE;
}
// If no usable window is found and 'switchbuf' contains "usetab"
@@ -3089,7 +3086,7 @@ qf_jump_to_usable_window(int qf_fnum, int newwin, int *opened_window)
else
{
if (curwin->w_llist_ref != NULL) // In a location window
- qf_goto_win_with_ll_file(usable_win_ptr, qf_fnum, ll_ref);
+ qf_goto_win_with_ll_file(usable_wp, qf_fnum, ll_ref);
else // In a quickfix window
qf_goto_win_with_qfl_file(qf_fnum);
}
@@ -3454,17 +3451,12 @@ theend:
qfl->qf_ptr = qf_ptr;
qfl->qf_index = qf_index;
}
- if (p_swb != old_swb)
+ if (p_swb != old_swb && p_swb == empty_option)
{
// Restore old 'switchbuf' value, but not when an autocommand or
// modeline has changed the value.
- if (p_swb == empty_option)
- {
- p_swb = old_swb;
- swb_flags = old_swb_flags;
- }
- else
- free_string_option(old_swb);
+ p_swb = old_swb;
+ swb_flags = old_swb_flags;
}
decr_quickfix_busy();
}