if (cmdmod.cmod_split == 0)
flags = WSP_BELOW;
flags |= WSP_NEWLOC;
+
+ // Create a snapshot for quickfix window (not for location list)
+ // so that when closing it, we can restore to the previous window
+ if (IS_QF_STACK(qi))
+ flags |= WSP_QUICKFIX;
+
if (win_split(height, flags) == FAIL)
return FAIL; // not enough room for window
RESET_BINDING(curwin);
#define WSP_ABOVE 0x80 // put new window above/left
#define WSP_NEWLOC 0x100 // don't copy location list
#define WSP_FORCE_ROOM 0x200 // ignore "not enough room" errors
+#define WSP_QUICKFIX 0x400 // creating the quickfix window
/*
* arguments for gui_set_shellsize()
else
clear_snapshot(curtab, SNAP_HELP_IDX);
+ if (flags & WSP_QUICKFIX)
+ make_snapshot(SNAP_QUICKFIX_IDX);
+ else
+ clear_snapshot(curtab, SNAP_QUICKFIX_IDX);
+
return win_split_ins(size, flags, NULL, 0, NULL);
}
int close_curwin = FALSE;
int dir;
int help_window = FALSE;
+ int quickfix_window = FALSE;
tabpage_T *prev_curtab = curtab;
frame_T *win_frame = win->w_frame->fr_parent;
#ifdef FEAT_DIFF
else
clear_snapshot(curtab, SNAP_HELP_IDX);
+ if (bt_quickfix(win->w_buffer))
+ quickfix_window = TRUE;
+ else
+ clear_snapshot(curtab, SNAP_QUICKFIX_IDX);
+
if (win == curwin)
{
#ifdef FEAT_JOB_CHANNEL
// the screen space.
wp = win_free_mem(win, &dir, NULL);
- if (help_window)
+ if (help_window || quickfix_window)
{
// Closing the help window moves the cursor back to the current window
// of the snapshot.
- win_T *prev_win = get_snapshot_curwin(SNAP_HELP_IDX);
+ win_T *prev_win = get_snapshot_curwin(help_window ? SNAP_HELP_IDX : SNAP_QUICKFIX_IDX);
if (win_valid(prev_win))
wp = prev_win;
--dont_parse_messages;
#endif
- // After closing the help window, try restoring the window layout from
- // before it was opened.
- if (help_window)
- restore_snapshot(SNAP_HELP_IDX, close_curwin);
+ // After closing the help or quickfix window, try restoring the window
+ // layout from before it was opened.
+ if (help_window || quickfix_window)
+ restore_snapshot(help_window ? SNAP_HELP_IDX : SNAP_QUICKFIX_IDX,
+ close_curwin);
#ifdef FEAT_DIFF
// If the window had 'diff' set and now there is only one window left in