|
|
@@ -905,7 +905,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
|
|
|
|
int new_size = size;
|
|
|
|
int new_size = size;
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
int need_status = 0;
|
|
|
|
int need_status = 0;
|
|
|
|
int do_equal = FALSE;
|
|
|
|
bool do_equal = false;
|
|
|
|
int needed;
|
|
|
|
int needed;
|
|
|
|
int available;
|
|
|
|
int available;
|
|
|
|
int oldwin_height = 0;
|
|
|
|
int oldwin_height = 0;
|
|
|
@@ -991,9 +991,10 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
|
|
|
|
new_size = wmw1;
|
|
|
|
new_size = wmw1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* if it doesn't fit in the current window, need win_equal() */
|
|
|
|
// if it doesn't fit in the current window, need win_equal()
|
|
|
|
if (oldwin->w_width - new_size - 1 < p_wmw)
|
|
|
|
if (oldwin->w_width - new_size - 1 < p_wmw) {
|
|
|
|
do_equal = TRUE;
|
|
|
|
do_equal = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// We don't like to take lines for the new window from a
|
|
|
|
// We don't like to take lines for the new window from a
|
|
|
|
// 'winfixwidth' window. Take them from a window to the left or right
|
|
|
|
// 'winfixwidth' window. Take them from a window to the left or right
|
|
|
@@ -1010,9 +1011,9 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
|
|
|
|
while (frp != NULL) {
|
|
|
|
while (frp != NULL) {
|
|
|
|
if (frp->fr_win != oldwin && frp->fr_win != NULL
|
|
|
|
if (frp->fr_win != oldwin && frp->fr_win != NULL
|
|
|
|
&& (frp->fr_win->w_width > new_size
|
|
|
|
&& (frp->fr_win->w_width > new_size
|
|
|
|
|| frp->fr_win->w_width > oldwin->w_width
|
|
|
|
|| frp->fr_win->w_width > (oldwin->w_width
|
|
|
|
- new_size - 1)) {
|
|
|
|
- new_size - 1))) {
|
|
|
|
do_equal = TRUE;
|
|
|
|
do_equal = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
frp = frp->fr_next;
|
|
|
|
frp = frp->fr_next;
|
|
|
@@ -1075,9 +1076,10 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
|
|
|
|
new_size = wmh1;
|
|
|
|
new_size = wmh1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* if it doesn't fit in the current window, need win_equal() */
|
|
|
|
// if it doesn't fit in the current window, need win_equal()
|
|
|
|
if (oldwin_height - new_size - STATUS_HEIGHT < p_wmh)
|
|
|
|
if (oldwin_height - new_size - STATUS_HEIGHT < p_wmh) {
|
|
|
|
do_equal = TRUE;
|
|
|
|
do_equal = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* We don't like to take lines for the new window from a
|
|
|
|
/* We don't like to take lines for the new window from a
|
|
|
|
* 'winfixheight' window. Take them from a window above or below
|
|
|
|
* 'winfixheight' window. Take them from a window above or below
|
|
|
@@ -1106,7 +1108,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
|
|
|
|
&& (frp->fr_win->w_height > new_size
|
|
|
|
&& (frp->fr_win->w_height > new_size
|
|
|
|
|| frp->fr_win->w_height > oldwin_height - new_size
|
|
|
|
|| frp->fr_win->w_height > oldwin_height - new_size
|
|
|
|
- STATUS_HEIGHT)) {
|
|
|
|
- STATUS_HEIGHT)) {
|
|
|
|
do_equal = TRUE;
|
|
|
|
do_equal = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
frp = frp->fr_next;
|
|
|
|
frp = frp->fr_next;
|
|
|
@@ -1121,19 +1123,19 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
|
|
|
|
&& ((flags & WSP_BOT)
|
|
|
|
&& ((flags & WSP_BOT)
|
|
|
|
|| (flags & WSP_BELOW)
|
|
|
|
|| (flags & WSP_BELOW)
|
|
|
|
|| (!(flags & WSP_ABOVE)
|
|
|
|
|| (!(flags & WSP_ABOVE)
|
|
|
|
&& (
|
|
|
|
&& ((flags & WSP_VERT) ? p_spr : p_sb)))) {
|
|
|
|
(flags & WSP_VERT) ? p_spr :
|
|
|
|
// new window below/right of current one
|
|
|
|
p_sb)))) {
|
|
|
|
if (new_wp == NULL) {
|
|
|
|
/* new window below/right of current one */
|
|
|
|
wp = win_alloc(oldwin, false);
|
|
|
|
if (new_wp == NULL)
|
|
|
|
} else {
|
|
|
|
wp = win_alloc(oldwin, FALSE);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
win_append(oldwin, wp);
|
|
|
|
win_append(oldwin, wp);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (new_wp == NULL)
|
|
|
|
if (new_wp == NULL) {
|
|
|
|
wp = win_alloc(oldwin->w_prev, FALSE);
|
|
|
|
wp = win_alloc(oldwin->w_prev, false);
|
|
|
|
else
|
|
|
|
} else {
|
|
|
|
win_append(oldwin->w_prev, wp);
|
|
|
|
win_append(oldwin->w_prev, wp);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (new_wp == NULL) {
|
|
|
|
if (new_wp == NULL) {
|
|
|
@@ -1248,11 +1250,12 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
|
|
|
|
frame_add_vsep(curfrp);
|
|
|
|
frame_add_vsep(curfrp);
|
|
|
|
/* Set width of neighbor frame */
|
|
|
|
/* Set width of neighbor frame */
|
|
|
|
frame_new_width(curfrp, curfrp->fr_width
|
|
|
|
frame_new_width(curfrp, curfrp->fr_width
|
|
|
|
- (new_size + ((flags & WSP_TOP) != 0)), flags & WSP_TOP,
|
|
|
|
- (new_size + ((flags & WSP_TOP) != 0)), flags & WSP_TOP,
|
|
|
|
FALSE);
|
|
|
|
false);
|
|
|
|
} else
|
|
|
|
} else {
|
|
|
|
win_new_width(oldwin, oldwin->w_width - (new_size + 1));
|
|
|
|
win_new_width(oldwin, oldwin->w_width - (new_size + 1));
|
|
|
|
if (before) { /* new window left of current one */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (before) { // new window left of current one
|
|
|
|
wp->w_wincol = oldwin->w_wincol;
|
|
|
|
wp->w_wincol = oldwin->w_wincol;
|
|
|
|
oldwin->w_wincol += new_size + 1;
|
|
|
|
oldwin->w_wincol += new_size + 1;
|
|
|
|
} else /* new window right of current one */
|
|
|
|
} else /* new window right of current one */
|
|
|
@@ -1439,7 +1442,7 @@ static void win_init_some(win_T *newp, win_T *oldp)
|
|
|
|
win_copy_options(oldp, newp);
|
|
|
|
win_copy_options(oldp, newp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Return TRUE if "win" is floating window in the current tab page.
|
|
|
|
/// Return true if "win" is floating window in the current tab page.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// @param win window to check
|
|
|
|
/// @param win window to check
|
|
|
|
bool win_valid_floating(const win_T *win)
|
|
|
|
bool win_valid_floating(const win_T *win)
|
|
|
@@ -1517,17 +1520,14 @@ int win_count(void)
|
|
|
|
return count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// Make "count" windows on the screen.
|
|
|
|
* Make "count" windows on the screen.
|
|
|
|
/// Must be called when there is just one window, filling the whole screen
|
|
|
|
* Return actual number of windows on the screen.
|
|
|
|
/// (excluding the command line).
|
|
|
|
* Must be called when there is just one window, filling the whole screen
|
|
|
|
///
|
|
|
|
* (excluding the command line).
|
|
|
|
/// @param vertical split windows vertically if true
|
|
|
|
*/
|
|
|
|
///
|
|
|
|
int
|
|
|
|
/// @return actual number of windows on the screen.
|
|
|
|
make_windows (
|
|
|
|
int make_windows(int count, bool vertical)
|
|
|
|
int count,
|
|
|
|
|
|
|
|
int vertical /* split windows vertically if TRUE */
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int maxcount;
|
|
|
|
int maxcount;
|
|
|
|
int todo;
|
|
|
|
int todo;
|
|
|
@@ -1552,8 +1552,9 @@ make_windows (
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* add status line now, otherwise first window will be too big
|
|
|
|
* add status line now, otherwise first window will be too big
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (count > 1)
|
|
|
|
if (count > 1) {
|
|
|
|
last_status(TRUE);
|
|
|
|
last_status(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Don't execute autocommands while creating the windows. Must do that
|
|
|
|
* Don't execute autocommands while creating the windows. Must do that
|
|
|
@@ -1786,8 +1787,8 @@ static void win_totop(int size, int flags)
|
|
|
|
(void)winframe_remove(curwin, &dir, NULL);
|
|
|
|
(void)winframe_remove(curwin, &dir, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
win_remove(curwin, NULL);
|
|
|
|
win_remove(curwin, NULL);
|
|
|
|
last_status(FALSE); /* may need to remove last status line */
|
|
|
|
last_status(false); // may need to remove last status line
|
|
|
|
(void)win_comp_pos(); /* recompute window positions */
|
|
|
|
(void)win_comp_pos(); // recompute window positions
|
|
|
|
|
|
|
|
|
|
|
|
/* Split a window on the desired side and put the window there. */
|
|
|
|
/* Split a window on the desired side and put the window there. */
|
|
|
|
(void)win_split_ins(size, flags, curwin, dir);
|
|
|
|
(void)win_split_ins(size, flags, curwin, dir);
|
|
|
@@ -1898,7 +1899,7 @@ static void win_equal_rec(
|
|
|
|
int room = 0;
|
|
|
|
int room = 0;
|
|
|
|
int new_size;
|
|
|
|
int new_size;
|
|
|
|
int has_next_curwin = 0;
|
|
|
|
int has_next_curwin = 0;
|
|
|
|
int hnc;
|
|
|
|
bool hnc;
|
|
|
|
|
|
|
|
|
|
|
|
if (topfr->fr_layout == FR_LEAF) {
|
|
|
|
if (topfr->fr_layout == FR_LEAF) {
|
|
|
|
/* Set the width/height of this frame.
|
|
|
|
/* Set the width/height of this frame.
|
|
|
@@ -2002,17 +2003,20 @@ static void win_equal_rec(
|
|
|
|
wincount = (n + (fr->fr_next == NULL ? extra_sep : 0))
|
|
|
|
wincount = (n + (fr->fr_next == NULL ? extra_sep : 0))
|
|
|
|
/ (p_wmw + 1);
|
|
|
|
/ (p_wmw + 1);
|
|
|
|
m = frame_minwidth(fr, next_curwin);
|
|
|
|
m = frame_minwidth(fr, next_curwin);
|
|
|
|
if (has_next_curwin)
|
|
|
|
if (has_next_curwin) {
|
|
|
|
hnc = frame_has_win(fr, next_curwin);
|
|
|
|
hnc = frame_has_win(fr, next_curwin);
|
|
|
|
else
|
|
|
|
} else {
|
|
|
|
hnc = FALSE;
|
|
|
|
hnc = false;
|
|
|
|
if (hnc) /* don't count next_curwin */
|
|
|
|
}
|
|
|
|
--wincount;
|
|
|
|
if (hnc) { // don't count next_curwin
|
|
|
|
if (totwincount == 0)
|
|
|
|
wincount--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (totwincount == 0) {
|
|
|
|
new_size = room;
|
|
|
|
new_size = room;
|
|
|
|
else
|
|
|
|
} else {
|
|
|
|
new_size = (wincount * room + (totwincount / 2)) / totwincount;
|
|
|
|
new_size = (wincount * room + (totwincount / 2)) / totwincount;
|
|
|
|
if (hnc) { /* add next_curwin size */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hnc) { // add next_curwin size
|
|
|
|
next_curwin_size -= p_wiw - (m - n);
|
|
|
|
next_curwin_size -= p_wiw - (m - n);
|
|
|
|
new_size += next_curwin_size;
|
|
|
|
new_size += next_curwin_size;
|
|
|
|
room -= new_size - next_curwin_size;
|
|
|
|
room -= new_size - next_curwin_size;
|
|
|
@@ -2123,17 +2127,20 @@ static void win_equal_rec(
|
|
|
|
wincount = (n + (fr->fr_next == NULL ? extra_sep : 0))
|
|
|
|
wincount = (n + (fr->fr_next == NULL ? extra_sep : 0))
|
|
|
|
/ (p_wmh + 1);
|
|
|
|
/ (p_wmh + 1);
|
|
|
|
m = frame_minheight(fr, next_curwin);
|
|
|
|
m = frame_minheight(fr, next_curwin);
|
|
|
|
if (has_next_curwin)
|
|
|
|
if (has_next_curwin) {
|
|
|
|
hnc = frame_has_win(fr, next_curwin);
|
|
|
|
hnc = frame_has_win(fr, next_curwin);
|
|
|
|
else
|
|
|
|
} else {
|
|
|
|
hnc = FALSE;
|
|
|
|
hnc = false;
|
|
|
|
if (hnc) /* don't count next_curwin */
|
|
|
|
}
|
|
|
|
--wincount;
|
|
|
|
if (hnc) { // don't count next_curwin
|
|
|
|
if (totwincount == 0)
|
|
|
|
wincount--;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (totwincount == 0) {
|
|
|
|
new_size = room;
|
|
|
|
new_size = room;
|
|
|
|
else
|
|
|
|
} else {
|
|
|
|
new_size = (wincount * room + (totwincount / 2)) / totwincount;
|
|
|
|
new_size = (wincount * room + (totwincount / 2)) / totwincount;
|
|
|
|
if (hnc) { /* add next_curwin size */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hnc) { // add next_curwin size
|
|
|
|
next_curwin_size -= p_wh - (m - n);
|
|
|
|
next_curwin_size -= p_wh - (m - n);
|
|
|
|
new_size += next_curwin_size;
|
|
|
|
new_size += next_curwin_size;
|
|
|
|
room -= new_size - next_curwin_size;
|
|
|
|
room -= new_size - next_curwin_size;
|
|
|
@@ -2311,8 +2318,8 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf,
|
|
|
|
int win_close(win_T *win, bool free_buf)
|
|
|
|
int win_close(win_T *win, bool free_buf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
win_T *wp;
|
|
|
|
win_T *wp;
|
|
|
|
int other_buffer = FALSE;
|
|
|
|
bool other_buffer = false;
|
|
|
|
int close_curwin = FALSE;
|
|
|
|
bool close_curwin = false;
|
|
|
|
int dir;
|
|
|
|
int dir;
|
|
|
|
bool help_window = false;
|
|
|
|
bool help_window = false;
|
|
|
|
tabpage_T *prev_curtab = curtab;
|
|
|
|
tabpage_T *prev_curtab = curtab;
|
|
|
@@ -2377,7 +2384,7 @@ int win_close(win_T *win, bool free_buf)
|
|
|
|
* to be the last one left, return now.
|
|
|
|
* to be the last one left, return now.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (wp->w_buffer != curbuf) {
|
|
|
|
if (wp->w_buffer != curbuf) {
|
|
|
|
other_buffer = TRUE;
|
|
|
|
other_buffer = true;
|
|
|
|
win->w_closing = true;
|
|
|
|
win->w_closing = true;
|
|
|
|
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
|
|
|
|
apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
|
|
|
|
if (!win_valid(win))
|
|
|
|
if (!win_valid(win))
|
|
|
@@ -2516,7 +2523,7 @@ int win_close(win_T *win, bool free_buf)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
curbuf = curwin->w_buffer;
|
|
|
|
curbuf = curwin->w_buffer;
|
|
|
|
close_curwin = TRUE;
|
|
|
|
close_curwin = true;
|
|
|
|
|
|
|
|
|
|
|
|
// The cursor position may be invalid if the buffer changed after last
|
|
|
|
// The cursor position may be invalid if the buffer changed after last
|
|
|
|
// using the window.
|
|
|
|
// using the window.
|
|
|
@@ -2545,7 +2552,7 @@ int win_close(win_T *win, bool free_buf)
|
|
|
|
* If last window has a status line now and we don't want one,
|
|
|
|
* If last window has a status line now and we don't want one,
|
|
|
|
* remove the status line.
|
|
|
|
* remove the status line.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
last_status(FALSE);
|
|
|
|
last_status(false);
|
|
|
|
|
|
|
|
|
|
|
|
/* After closing the help window, try restoring the window layout from
|
|
|
|
/* After closing the help window, try restoring the window layout from
|
|
|
|
* before it was opened. */
|
|
|
|
* before it was opened. */
|
|
|
@@ -2798,7 +2805,7 @@ winframe_remove (
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
frame_new_height(frp2, frp2->fr_height + frp_close->fr_height,
|
|
|
|
frame_new_height(frp2, frp2->fr_height + frp_close->fr_height,
|
|
|
|
frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
|
|
|
|
frp2 == frp_close->fr_next, false);
|
|
|
|
*dirp = 'v';
|
|
|
|
*dirp = 'v';
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
/* When 'winfixwidth' is set, try to find another frame in the column
|
|
|
|
/* When 'winfixwidth' is set, try to find another frame in the column
|
|
|
@@ -2827,7 +2834,7 @@ winframe_remove (
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
frame_new_width(frp2, frp2->fr_width + frp_close->fr_width,
|
|
|
|
frame_new_width(frp2, frp2->fr_width + frp_close->fr_width,
|
|
|
|
frp2 == frp_close->fr_next ? TRUE : FALSE, FALSE);
|
|
|
|
frp2 == frp_close->fr_next, false);
|
|
|
|
*dirp = 'h';
|
|
|
|
*dirp = 'h';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@@ -2983,18 +2990,14 @@ static bool frame_has_win(const frame_T *frp, const win_T *wp)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// Set a new height for a frame. Recursively sets the height for contained
|
|
|
|
* Set a new height for a frame. Recursively sets the height for contained
|
|
|
|
/// frames and windows. Caller must take care of positions.
|
|
|
|
* frames and windows. Caller must take care of positions.
|
|
|
|
///
|
|
|
|
*/
|
|
|
|
/// @param topfirst resize topmost contained frame first.
|
|
|
|
static void
|
|
|
|
/// @param wfh obey 'winfixheight' when there is a choice;
|
|
|
|
frame_new_height (
|
|
|
|
/// may cause the height not to be set.
|
|
|
|
frame_T *topfrp,
|
|
|
|
static void frame_new_height(frame_T *topfrp, int height, bool topfirst,
|
|
|
|
int height,
|
|
|
|
bool wfh)
|
|
|
|
int topfirst, /* resize topmost contained frame first */
|
|
|
|
|
|
|
|
int wfh /* obey 'winfixheight' when there is a choice;
|
|
|
|
|
|
|
|
may cause the height not to be set */
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
FUNC_ATTR_NONNULL_ALL
|
|
|
|
FUNC_ATTR_NONNULL_ALL
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frame_T *frp;
|
|
|
|
frame_T *frp;
|
|
|
@@ -3170,18 +3173,14 @@ static void frame_add_statusline(frame_T *frp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// Set width of a frame. Handles recursively going through contained frames.
|
|
|
|
* Set width of a frame. Handles recursively going through contained frames.
|
|
|
|
/// May remove separator line for windows at the right side (for win_close()).
|
|
|
|
* May remove separator line for windows at the right side (for win_close()).
|
|
|
|
///
|
|
|
|
*/
|
|
|
|
/// @param leftfirst resize leftmost contained frame first.
|
|
|
|
static void
|
|
|
|
/// @param wfw obey 'winfixwidth' when there is a choice;
|
|
|
|
frame_new_width (
|
|
|
|
/// may cause the width not to be set.
|
|
|
|
frame_T *topfrp,
|
|
|
|
static void frame_new_width(frame_T *topfrp, int width, bool leftfirst,
|
|
|
|
int width,
|
|
|
|
bool wfw)
|
|
|
|
int leftfirst, /* resize leftmost contained frame first */
|
|
|
|
|
|
|
|
int wfw /* obey 'winfixwidth' when there is a choice;
|
|
|
|
|
|
|
|
may cause the width not to be set */
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frame_T *frp;
|
|
|
|
frame_T *frp;
|
|
|
|
int extra_cols;
|
|
|
|
int extra_cols;
|
|
|
@@ -3538,7 +3537,7 @@ void win_alloc_aucmd_win(void)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static int win_alloc_firstwin(win_T *oldwin)
|
|
|
|
static int win_alloc_firstwin(win_T *oldwin)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
curwin = win_alloc(NULL, FALSE);
|
|
|
|
curwin = win_alloc(NULL, false);
|
|
|
|
if (oldwin == NULL) {
|
|
|
|
if (oldwin == NULL) {
|
|
|
|
/* Very first window, need to create an empty buffer for it and
|
|
|
|
/* Very first window, need to create an empty buffer for it and
|
|
|
|
* initialize from scratch. */
|
|
|
|
* initialize from scratch. */
|
|
|
@@ -4342,13 +4341,13 @@ void win_enter(win_T *wp, bool undo_sync)
|
|
|
|
win_enter_ext(wp, undo_sync, false, false, true, true);
|
|
|
|
win_enter_ext(wp, undo_sync, false, false, true, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// Make window wp the current window.
|
|
|
|
* Make window wp the current window.
|
|
|
|
///
|
|
|
|
* Can be called with "curwin_invalid" TRUE, which means that curwin has just
|
|
|
|
/// @param curwin_invalid curwin has just been closed and
|
|
|
|
* been closed and isn't valid.
|
|
|
|
/// isn't valid when true.
|
|
|
|
*/
|
|
|
|
static void win_enter_ext(win_T *wp, bool undo_sync, bool curwin_invalid,
|
|
|
|
static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
|
|
|
|
bool trigger_new_autocmds,
|
|
|
|
int trigger_new_autocmds, bool trigger_enter_autocmds,
|
|
|
|
bool trigger_enter_autocmds,
|
|
|
|
bool trigger_leave_autocmds)
|
|
|
|
bool trigger_leave_autocmds)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int other_buffer = FALSE;
|
|
|
|
int other_buffer = FALSE;
|
|
|
@@ -4376,7 +4375,7 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
|
|
|
|
|
|
|
|
|
|
|
|
// sync undo before leaving the current buffer
|
|
|
|
// sync undo before leaving the current buffer
|
|
|
|
if (undo_sync && curbuf != wp->w_buffer) {
|
|
|
|
if (undo_sync && curbuf != wp->w_buffer) {
|
|
|
|
u_sync(FALSE);
|
|
|
|
u_sync(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Might need to scroll the old window before switching, e.g., when the
|
|
|
|
// Might need to scroll the old window before switching, e.g., when the
|
|
|
@@ -4536,11 +4535,9 @@ win_T *buf_jump_open_tab(buf_T *buf)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// @param hidden allocate a window structure and link it in the window if
|
|
|
|
* Allocate a window structure and link it in the window list when "hidden" is
|
|
|
|
// false.
|
|
|
|
* FALSE.
|
|
|
|
static win_T *win_alloc(win_T *after, bool hidden)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static win_T *win_alloc(win_T *after, int hidden)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static int last_win_id = LOWEST_WIN_ID - 1;
|
|
|
|
static int last_win_id = LOWEST_WIN_ID - 1;
|
|
|
|
|
|
|
|
|
|
|
@@ -4830,9 +4827,10 @@ void shell_new_rows(void)
|
|
|
|
|
|
|
|
|
|
|
|
/* First try setting the heights of windows with 'winfixheight'. If
|
|
|
|
/* First try setting the heights of windows with 'winfixheight'. If
|
|
|
|
* that doesn't result in the right height, forget about that option. */
|
|
|
|
* that doesn't result in the right height, forget about that option. */
|
|
|
|
frame_new_height(topframe, h, FALSE, TRUE);
|
|
|
|
frame_new_height(topframe, h, false, true);
|
|
|
|
if (!frame_check_height(topframe, h))
|
|
|
|
if (!frame_check_height(topframe, h)) {
|
|
|
|
frame_new_height(topframe, h, FALSE, FALSE);
|
|
|
|
frame_new_height(topframe, h, false, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
(void)win_comp_pos(); // recompute w_winrow and w_wincol
|
|
|
|
(void)win_comp_pos(); // recompute w_winrow and w_wincol
|
|
|
|
win_reconfig_floats(); // The size of floats might change
|
|
|
|
win_reconfig_floats(); // The size of floats might change
|
|
|
@@ -5078,8 +5076,9 @@ static void frame_setheight(frame_T *curfrp, int height)
|
|
|
|
/* topframe: can only change the command line */
|
|
|
|
/* topframe: can only change the command line */
|
|
|
|
if (height > ROWS_AVAIL)
|
|
|
|
if (height > ROWS_AVAIL)
|
|
|
|
height = ROWS_AVAIL;
|
|
|
|
height = ROWS_AVAIL;
|
|
|
|
if (height > 0)
|
|
|
|
if (height > 0) {
|
|
|
|
frame_new_height(curfrp, height, FALSE, FALSE);
|
|
|
|
frame_new_height(curfrp, height, false, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if (curfrp->fr_parent->fr_layout == FR_ROW) {
|
|
|
|
} else if (curfrp->fr_parent->fr_layout == FR_ROW) {
|
|
|
|
/* Row of frames: Also need to resize frames left and right of this
|
|
|
|
/* Row of frames: Also need to resize frames left and right of this
|
|
|
|
* one. First check for the minimal height of these. */
|
|
|
|
* one. First check for the minimal height of these. */
|
|
|
@@ -5161,7 +5160,7 @@ static void frame_setheight(frame_T *curfrp, int height)
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* set the current frame to the new height
|
|
|
|
* set the current frame to the new height
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
frame_new_height(curfrp, height, FALSE, FALSE);
|
|
|
|
frame_new_height(curfrp, height, false, false);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* First take lines from the frames after the current frame. If
|
|
|
|
* First take lines from the frames after the current frame. If
|
|
|
@@ -5184,16 +5183,15 @@ static void frame_setheight(frame_T *curfrp, int height)
|
|
|
|
if (frp->fr_height - room_reserved > take)
|
|
|
|
if (frp->fr_height - room_reserved > take)
|
|
|
|
room_reserved = frp->fr_height - take;
|
|
|
|
room_reserved = frp->fr_height - take;
|
|
|
|
take -= frp->fr_height - room_reserved;
|
|
|
|
take -= frp->fr_height - room_reserved;
|
|
|
|
frame_new_height(frp, room_reserved, FALSE, FALSE);
|
|
|
|
frame_new_height(frp, room_reserved, false, false);
|
|
|
|
room_reserved = 0;
|
|
|
|
room_reserved = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (frp->fr_height - take < h) {
|
|
|
|
if (frp->fr_height - take < h) {
|
|
|
|
take -= frp->fr_height - h;
|
|
|
|
take -= frp->fr_height - h;
|
|
|
|
frame_new_height(frp, h, FALSE, FALSE);
|
|
|
|
frame_new_height(frp, h, false, false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
frame_new_height(frp, frp->fr_height - take,
|
|
|
|
frame_new_height(frp, frp->fr_height - take, false, false);
|
|
|
|
FALSE, FALSE);
|
|
|
|
|
|
|
|
take = 0;
|
|
|
|
take = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -5324,7 +5322,7 @@ static void frame_setwidth(frame_T *curfrp, int width)
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* set the current frame to the new width
|
|
|
|
* set the current frame to the new width
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
frame_new_width(curfrp, width, FALSE, FALSE);
|
|
|
|
frame_new_width(curfrp, width, false, false);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* First take lines from the frames right of the current frame. If
|
|
|
|
* First take lines from the frames right of the current frame. If
|
|
|
@@ -5347,16 +5345,15 @@ static void frame_setwidth(frame_T *curfrp, int width)
|
|
|
|
if (frp->fr_width - room_reserved > take)
|
|
|
|
if (frp->fr_width - room_reserved > take)
|
|
|
|
room_reserved = frp->fr_width - take;
|
|
|
|
room_reserved = frp->fr_width - take;
|
|
|
|
take -= frp->fr_width - room_reserved;
|
|
|
|
take -= frp->fr_width - room_reserved;
|
|
|
|
frame_new_width(frp, room_reserved, FALSE, FALSE);
|
|
|
|
frame_new_width(frp, room_reserved, false, false);
|
|
|
|
room_reserved = 0;
|
|
|
|
room_reserved = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (frp->fr_width - take < w) {
|
|
|
|
if (frp->fr_width - take < w) {
|
|
|
|
take -= frp->fr_width - w;
|
|
|
|
take -= frp->fr_width - w;
|
|
|
|
frame_new_width(frp, w, FALSE, FALSE);
|
|
|
|
frame_new_width(frp, w, false, false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
frame_new_width(frp, frp->fr_width - take,
|
|
|
|
frame_new_width(frp, frp->fr_width - take, false, false);
|
|
|
|
FALSE, FALSE);
|
|
|
|
|
|
|
|
take = 0;
|
|
|
|
take = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -5409,16 +5406,14 @@ void win_setminwidth(void)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// Status line of dragwin is dragged "offset" lines down (negative is up).
|
|
|
|
* Status line of dragwin is dragged "offset" lines down (negative is up).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void win_drag_status_line(win_T *dragwin, int offset)
|
|
|
|
void win_drag_status_line(win_T *dragwin, int offset)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frame_T *curfr;
|
|
|
|
frame_T *curfr;
|
|
|
|
frame_T *fr;
|
|
|
|
frame_T *fr;
|
|
|
|
int room;
|
|
|
|
int room;
|
|
|
|
int row;
|
|
|
|
int row;
|
|
|
|
int up; /* if TRUE, drag status line up, otherwise down */
|
|
|
|
bool up; // if true, drag status line up, otherwise down
|
|
|
|
int n;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
|
|
fr = dragwin->w_frame;
|
|
|
|
fr = dragwin->w_frame;
|
|
|
@@ -5444,8 +5439,8 @@ void win_drag_status_line(win_T *dragwin, int offset)
|
|
|
|
fr = fr->fr_parent;
|
|
|
|
fr = fr->fr_parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (offset < 0) { /* drag up */
|
|
|
|
if (offset < 0) { // drag up
|
|
|
|
up = TRUE;
|
|
|
|
up = true;
|
|
|
|
offset = -offset;
|
|
|
|
offset = -offset;
|
|
|
|
/* sum up the room of the current frame and above it */
|
|
|
|
/* sum up the room of the current frame and above it */
|
|
|
|
if (fr == curfr) {
|
|
|
|
if (fr == curfr) {
|
|
|
@@ -5459,12 +5454,10 @@ void win_drag_status_line(win_T *dragwin, int offset)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fr = curfr->fr_next; /* put fr at frame that grows */
|
|
|
|
fr = curfr->fr_next; // put fr at frame that grows
|
|
|
|
} else { /* drag down */
|
|
|
|
} else { // drag down
|
|
|
|
up = FALSE;
|
|
|
|
up = false;
|
|
|
|
/*
|
|
|
|
// Only dragging the last status line can reduce p_ch.
|
|
|
|
* Only dragging the last status line can reduce p_ch.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
room = Rows - cmdline_row;
|
|
|
|
room = Rows - cmdline_row;
|
|
|
|
if (curfr->fr_next == NULL)
|
|
|
|
if (curfr->fr_next == NULL)
|
|
|
|
room -= 1;
|
|
|
|
room -= 1;
|
|
|
@@ -5488,8 +5481,9 @@ void win_drag_status_line(win_T *dragwin, int offset)
|
|
|
|
* Grow frame fr by "offset" lines.
|
|
|
|
* Grow frame fr by "offset" lines.
|
|
|
|
* Doesn't happen when dragging the last status line up.
|
|
|
|
* Doesn't happen when dragging the last status line up.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (fr != NULL)
|
|
|
|
if (fr != NULL) {
|
|
|
|
frame_new_height(fr, fr->fr_height + offset, up, FALSE);
|
|
|
|
frame_new_height(fr, fr->fr_height + offset, up, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (up)
|
|
|
|
if (up)
|
|
|
|
fr = curfr; /* current frame gets smaller */
|
|
|
|
fr = curfr; /* current frame gets smaller */
|
|
|
@@ -5503,9 +5497,9 @@ void win_drag_status_line(win_T *dragwin, int offset)
|
|
|
|
n = frame_minheight(fr, NULL);
|
|
|
|
n = frame_minheight(fr, NULL);
|
|
|
|
if (fr->fr_height - offset <= n) {
|
|
|
|
if (fr->fr_height - offset <= n) {
|
|
|
|
offset -= fr->fr_height - n;
|
|
|
|
offset -= fr->fr_height - n;
|
|
|
|
frame_new_height(fr, n, !up, FALSE);
|
|
|
|
frame_new_height(fr, n, !up, false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
frame_new_height(fr, fr->fr_height - offset, !up, FALSE);
|
|
|
|
frame_new_height(fr, fr->fr_height - offset, !up, false);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (up)
|
|
|
|
if (up)
|
|
|
@@ -5535,7 +5529,7 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|
|
|
frame_T *curfr;
|
|
|
|
frame_T *curfr;
|
|
|
|
frame_T *fr;
|
|
|
|
frame_T *fr;
|
|
|
|
int room;
|
|
|
|
int room;
|
|
|
|
int left; /* if TRUE, drag separator line left, otherwise right */
|
|
|
|
bool left; // if true, drag separator line left, otherwise right
|
|
|
|
int n;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
|
|
fr = dragwin->w_frame;
|
|
|
|
fr = dragwin->w_frame;
|
|
|
@@ -5564,8 +5558,8 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (offset < 0) { /* drag left */
|
|
|
|
if (offset < 0) { // drag left
|
|
|
|
left = TRUE;
|
|
|
|
left = true;
|
|
|
|
offset = -offset;
|
|
|
|
offset = -offset;
|
|
|
|
/* sum up the room of the current frame and left of it */
|
|
|
|
/* sum up the room of the current frame and left of it */
|
|
|
|
room = 0;
|
|
|
|
room = 0;
|
|
|
@@ -5574,10 +5568,10 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|
|
|
if (fr == curfr)
|
|
|
|
if (fr == curfr)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fr = curfr->fr_next; /* put fr at frame that grows */
|
|
|
|
fr = curfr->fr_next; // put fr at frame that grows
|
|
|
|
} else { /* drag right */
|
|
|
|
} else { // drag right
|
|
|
|
left = FALSE;
|
|
|
|
left = false;
|
|
|
|
/* sum up the room of frames right of the current one */
|
|
|
|
// sum up the room of frames right of the current one
|
|
|
|
room = 0;
|
|
|
|
room = 0;
|
|
|
|
FOR_ALL_FRAMES(fr, curfr->fr_next) {
|
|
|
|
FOR_ALL_FRAMES(fr, curfr->fr_next) {
|
|
|
|
room += fr->fr_width - frame_minwidth(fr, NULL);
|
|
|
|
room += fr->fr_width - frame_minwidth(fr, NULL);
|
|
|
@@ -5600,8 +5594,8 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|
|
|
return; // Safety check, should not happen.
|
|
|
|
return; // Safety check, should not happen.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* grow frame fr by offset lines */
|
|
|
|
// grow frame fr by offset lines
|
|
|
|
frame_new_width(fr, fr->fr_width + offset, left, FALSE);
|
|
|
|
frame_new_width(fr, fr->fr_width + offset, left, false);
|
|
|
|
|
|
|
|
|
|
|
|
/* shrink other frames: current and at the left or at the right */
|
|
|
|
/* shrink other frames: current and at the left or at the right */
|
|
|
|
if (left)
|
|
|
|
if (left)
|
|
|
@@ -5613,9 +5607,9 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|
|
|
n = frame_minwidth(fr, NULL);
|
|
|
|
n = frame_minwidth(fr, NULL);
|
|
|
|
if (fr->fr_width - offset <= n) {
|
|
|
|
if (fr->fr_width - offset <= n) {
|
|
|
|
offset -= fr->fr_width - n;
|
|
|
|
offset -= fr->fr_width - n;
|
|
|
|
frame_new_width(fr, n, !left, FALSE);
|
|
|
|
frame_new_width(fr, n, !left, false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
frame_new_width(fr, fr->fr_width - offset, !left, FALSE);
|
|
|
|
frame_new_width(fr, fr->fr_width - offset, !left, false);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (left)
|
|
|
|
if (left)
|
|
|
@@ -5927,7 +5921,7 @@ void command_height(void)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void frame_add_height(frame_T *frp, int n)
|
|
|
|
static void frame_add_height(frame_T *frp, int n)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frame_new_height(frp, frp->fr_height + n, FALSE, FALSE);
|
|
|
|
frame_new_height(frp, frp->fr_height + n, false, false);
|
|
|
|
for (;; ) {
|
|
|
|
for (;; ) {
|
|
|
|
frp = frp->fr_parent;
|
|
|
|
frp = frp->fr_parent;
|
|
|
|
if (frp == NULL)
|
|
|
|
if (frp == NULL)
|
|
|
@@ -6092,21 +6086,18 @@ file_name_in_line (
|
|
|
|
return find_file_name_in_path(ptr, len, options, count, rel_fname);
|
|
|
|
return find_file_name_in_path(ptr, len, options, count, rel_fname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// Add or remove a status line for the bottom window(s), according to the
|
|
|
|
* Add or remove a status line for the bottom window(s), according to the
|
|
|
|
/// value of 'laststatus'.
|
|
|
|
* value of 'laststatus'.
|
|
|
|
///
|
|
|
|
*/
|
|
|
|
/// @param morewin pretend there are two or more windows if true.
|
|
|
|
void
|
|
|
|
void last_status(bool morewin)
|
|
|
|
last_status (
|
|
|
|
|
|
|
|
int morewin /* pretend there are two or more windows */
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Don't make a difference between horizontal or vertical split. */
|
|
|
|
/* Don't make a difference between horizontal or vertical split. */
|
|
|
|
last_status_rec(topframe, (p_ls == 2
|
|
|
|
last_status_rec(topframe, (p_ls == 2
|
|
|
|
|| (p_ls == 1 && (morewin || !one_window()))));
|
|
|
|
|| (p_ls == 1 && (morewin || !one_window()))));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void last_status_rec(frame_T *fr, int statusline)
|
|
|
|
static void last_status_rec(frame_T *fr, bool statusline)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
frame_T *fp;
|
|
|
|
frame_T *fp;
|
|
|
|
win_T *wp;
|
|
|
|
win_T *wp;
|
|
|
@@ -6135,7 +6126,7 @@ static void last_status_rec(frame_T *fr, int statusline)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wp->w_status_height = 1;
|
|
|
|
wp->w_status_height = 1;
|
|
|
|
if (fp != fr) {
|
|
|
|
if (fp != fr) {
|
|
|
|
frame_new_height(fp, fp->fr_height - 1, FALSE, FALSE);
|
|
|
|
frame_new_height(fp, fp->fr_height - 1, false, false);
|
|
|
|
frame_fix_height(wp);
|
|
|
|
frame_fix_height(wp);
|
|
|
|
(void)win_comp_pos();
|
|
|
|
(void)win_comp_pos();
|
|
|
|
} else
|
|
|
|
} else
|
|
|
@@ -6214,12 +6205,11 @@ bool only_one_window(void) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
|
|
|
return count <= 1;
|
|
|
|
return count <= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// Correct the cursor line number in other windows. Used after changing the
|
|
|
|
* Correct the cursor line number in other windows. Used after changing the
|
|
|
|
/// current buffer, and before applying autocommands.
|
|
|
|
* current buffer, and before applying autocommands.
|
|
|
|
///
|
|
|
|
* When "do_curwin" is TRUE, also check current window.
|
|
|
|
/// @param do_curwin when true, also check current window.
|
|
|
|
*/
|
|
|
|
void check_lnums(bool do_curwin)
|
|
|
|
void check_lnums(int do_curwin)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
|
|
|
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
|
|
|
if ((do_curwin || wp != curwin) && wp->w_buffer == curbuf) {
|
|
|
|
if ((do_curwin || wp != curwin) && wp->w_buffer == curbuf) {
|
|
|
@@ -6367,8 +6357,8 @@ static win_T *restore_snapshot_rec(frame_T *sn, frame_T *fr)
|
|
|
|
fr->fr_height = sn->fr_height;
|
|
|
|
fr->fr_height = sn->fr_height;
|
|
|
|
fr->fr_width = sn->fr_width;
|
|
|
|
fr->fr_width = sn->fr_width;
|
|
|
|
if (fr->fr_layout == FR_LEAF) {
|
|
|
|
if (fr->fr_layout == FR_LEAF) {
|
|
|
|
frame_new_height(fr, fr->fr_height, FALSE, FALSE);
|
|
|
|
frame_new_height(fr, fr->fr_height, false, false);
|
|
|
|
frame_new_width(fr, fr->fr_width, FALSE, FALSE);
|
|
|
|
frame_new_width(fr, fr->fr_width, false, false);
|
|
|
|
wp = sn->fr_win;
|
|
|
|
wp = sn->fr_win;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sn->fr_next != NULL) {
|
|
|
|
if (sn->fr_next != NULL) {
|
|
|
@@ -6406,15 +6396,16 @@ static win_T *get_snapshot_focus(int idx)
|
|
|
|
return win_valid(sn->fr_win) ? sn->fr_win : NULL;
|
|
|
|
return win_valid(sn->fr_win) ? sn->fr_win : NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/// Set "win" to be the curwin and "tp" to be the current tab page.
|
|
|
|
* Set "win" to be the curwin and "tp" to be the current tab page.
|
|
|
|
/// restore_win() MUST be called to undo, also when FAIL is returned.
|
|
|
|
* restore_win() MUST be called to undo, also when FAIL is returned.
|
|
|
|
/// No autocommands will be executed until restore_win() is called.
|
|
|
|
* No autocommands will be executed until restore_win() is called.
|
|
|
|
///
|
|
|
|
* When "no_display" is TRUE the display won't be affected, no redraw is
|
|
|
|
/// @param no_display if true the display won't be affected, no redraw is
|
|
|
|
* triggered, another tabpage access is limited.
|
|
|
|
/// triggered, another tabpage access is limited.
|
|
|
|
* Returns FAIL if switching to "win" failed.
|
|
|
|
///
|
|
|
|
*/
|
|
|
|
/// @return FAIL if switching to "win" failed.
|
|
|
|
int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display)
|
|
|
|
int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win,
|
|
|
|
|
|
|
|
tabpage_T *tp, bool no_display)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
block_autocmds();
|
|
|
|
block_autocmds();
|
|
|
|
return switch_win_noblock(save_curwin, save_curtab, win, tp, no_display);
|
|
|
|
return switch_win_noblock(save_curwin, save_curtab, win, tp, no_display);
|
|
|
@@ -6422,7 +6413,7 @@ int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage
|
|
|
|
|
|
|
|
|
|
|
|
// As switch_win() but without blocking autocommands.
|
|
|
|
// As switch_win() but without blocking autocommands.
|
|
|
|
int switch_win_noblock(win_T **save_curwin, tabpage_T **save_curtab,
|
|
|
|
int switch_win_noblock(win_T **save_curwin, tabpage_T **save_curtab,
|
|
|
|
win_T *win, tabpage_T *tp, int no_display)
|
|
|
|
win_T *win, tabpage_T *tp, bool no_display)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
*save_curwin = curwin;
|
|
|
|
*save_curwin = curwin;
|
|
|
|
if (tp != NULL) {
|
|
|
|
if (tp != NULL) {
|
|
|
@@ -6695,8 +6686,9 @@ fail:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Delete match with ID 'id' in the match list of window 'wp'.
|
|
|
|
/// Delete match with ID 'id' in the match list of window 'wp'.
|
|
|
|
/// Print error messages if 'perr' is TRUE.
|
|
|
|
///
|
|
|
|
int match_delete(win_T *wp, int id, int perr)
|
|
|
|
/// @param perr print error messages if true.
|
|
|
|
|
|
|
|
int match_delete(win_T *wp, int id, bool perr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
matchitem_T *cur = wp->w_match_head;
|
|
|
|
matchitem_T *cur = wp->w_match_head;
|
|
|
|
matchitem_T *prev = cur;
|
|
|
|
matchitem_T *prev = cur;
|
|
|
|