forked from aniani/vim
patch 8.0.1375: window size wrong after maximizing with WinBar
Problem: Window size wrong after maximizing with WinBar. (Lifepillar) Solution: Fix height computations. Redraw window when it is zero height but has a WinBar. (closes #2356)
This commit is contained in:
@@ -1154,7 +1154,7 @@ win_update(win_T *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Window is zero-height: nothing to draw. */
|
/* Window is zero-height: nothing to draw. */
|
||||||
if (wp->w_height == 0)
|
if (wp->w_height + WINBAR_HEIGHT(wp) == 0)
|
||||||
{
|
{
|
||||||
wp->w_redr_type = 0;
|
wp->w_redr_type = 0;
|
||||||
return;
|
return;
|
||||||
|
@@ -771,6 +771,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 */
|
||||||
|
/**/
|
||||||
|
1375,
|
||||||
/**/
|
/**/
|
||||||
1374,
|
1374,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -1478,8 +1478,10 @@ typedef UINT32_TYPEDEF UINT32_T;
|
|||||||
#define STATUS_HEIGHT 1 /* height of a status line under a window */
|
#define STATUS_HEIGHT 1 /* height of a status line under a window */
|
||||||
#ifdef FEAT_MENU /* height of a status line under a window */
|
#ifdef FEAT_MENU /* height of a status line under a window */
|
||||||
# define WINBAR_HEIGHT(wp) (wp)->w_winbar_height
|
# define WINBAR_HEIGHT(wp) (wp)->w_winbar_height
|
||||||
|
# define VISIBLE_HEIGHT(wp) ((wp)->w_height + (wp)->w_winbar_height)
|
||||||
#else
|
#else
|
||||||
# define WINBAR_HEIGHT(wp) 0
|
# define WINBAR_HEIGHT(wp) 0
|
||||||
|
# define VISIBLE_HEIGHT(wp) (wp)->w_height
|
||||||
#endif
|
#endif
|
||||||
#define QF_WINHEIGHT 10 /* default height for quickfix window */
|
#define QF_WINHEIGHT 10 /* default height for quickfix window */
|
||||||
|
|
||||||
|
37
src/window.c
37
src/window.c
@@ -782,7 +782,7 @@ win_split_ins(
|
|||||||
/* add a status line when p_ls == 1 and splitting the first window */
|
/* add a status line when p_ls == 1 and splitting the first window */
|
||||||
if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0)
|
if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0)
|
||||||
{
|
{
|
||||||
if (oldwin->w_height <= p_wmh && new_wp == NULL)
|
if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL)
|
||||||
{
|
{
|
||||||
EMSG(_(e_noroom));
|
EMSG(_(e_noroom));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -892,7 +892,7 @@ win_split_ins(
|
|||||||
* height.
|
* height.
|
||||||
*/
|
*/
|
||||||
/* Current window requires at least 1 space. */
|
/* Current window requires at least 1 space. */
|
||||||
wmh1 = (p_wmh == 0 ? 1 : p_wmh);
|
wmh1 = (p_wmh == 0 ? 1 : p_wmh) + WINBAR_HEIGHT(curwin);
|
||||||
needed = wmh1 + STATUS_HEIGHT;
|
needed = wmh1 + STATUS_HEIGHT;
|
||||||
if (flags & WSP_ROOM)
|
if (flags & WSP_ROOM)
|
||||||
needed += p_wh - wmh1;
|
needed += p_wh - wmh1;
|
||||||
@@ -1105,7 +1105,7 @@ win_split_ins(
|
|||||||
{
|
{
|
||||||
/* height and row of new window is same as current window */
|
/* height and row of new window is same as current window */
|
||||||
wp->w_winrow = oldwin->w_winrow;
|
wp->w_winrow = oldwin->w_winrow;
|
||||||
win_new_height(wp, oldwin->w_height + WINBAR_HEIGHT(oldwin));
|
win_new_height(wp, VISIBLE_HEIGHT(oldwin));
|
||||||
wp->w_status_height = oldwin->w_status_height;
|
wp->w_status_height = oldwin->w_status_height;
|
||||||
}
|
}
|
||||||
frp->fr_height = curfrp->fr_height;
|
frp->fr_height = curfrp->fr_height;
|
||||||
@@ -1180,8 +1180,8 @@ win_split_ins(
|
|||||||
}
|
}
|
||||||
else /* new window below current one */
|
else /* new window below current one */
|
||||||
{
|
{
|
||||||
wp->w_winrow = oldwin->w_winrow + oldwin->w_height
|
wp->w_winrow = oldwin->w_winrow + VISIBLE_HEIGHT(oldwin)
|
||||||
+ STATUS_HEIGHT + WINBAR_HEIGHT(oldwin);
|
+ STATUS_HEIGHT;
|
||||||
wp->w_status_height = oldwin->w_status_height;
|
wp->w_status_height = oldwin->w_status_height;
|
||||||
if (!(flags & WSP_BOT))
|
if (!(flags & WSP_BOT))
|
||||||
oldwin->w_status_height = STATUS_HEIGHT;
|
oldwin->w_status_height = STATUS_HEIGHT;
|
||||||
@@ -1422,7 +1422,7 @@ make_windows(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Each window needs at least 'winminheight' lines and a status line. */
|
/* Each window needs at least 'winminheight' lines and a status line. */
|
||||||
maxcount = (curwin->w_height + curwin->w_status_height
|
maxcount = (VISIBLE_HEIGHT(curwin) + curwin->w_status_height
|
||||||
- (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT);
|
- (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3204,8 +3204,7 @@ frame_fix_width(win_T *wp)
|
|||||||
static void
|
static void
|
||||||
frame_fix_height(win_T *wp)
|
frame_fix_height(win_T *wp)
|
||||||
{
|
{
|
||||||
wp->w_frame->fr_height = wp->w_height + wp->w_status_height
|
wp->w_frame->fr_height = VISIBLE_HEIGHT(wp) + wp->w_status_height;
|
||||||
+ WINBAR_HEIGHT(wp) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3230,9 +3229,14 @@ frame_minheight(frame_T *topfrp, win_T *next_curwin)
|
|||||||
{
|
{
|
||||||
/* window: minimal height of the window plus status line */
|
/* window: minimal height of the window plus status line */
|
||||||
m = p_wmh + topfrp->fr_win->w_status_height;
|
m = p_wmh + topfrp->fr_win->w_status_height;
|
||||||
/* Current window is minimal one line high */
|
if (topfrp->fr_win == curwin && next_curwin == NULL)
|
||||||
if (p_wmh == 0 && topfrp->fr_win == curwin && next_curwin == NULL)
|
{
|
||||||
++m;
|
/* Current window is minimal one line high and WinBar is
|
||||||
|
* visible. */
|
||||||
|
if (p_wmh == 0)
|
||||||
|
++m;
|
||||||
|
m += WINBAR_HEIGHT(curwin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (topfrp->fr_layout == FR_ROW)
|
else if (topfrp->fr_layout == FR_ROW)
|
||||||
@@ -4972,6 +4976,7 @@ frame_comp_pos(frame_T *topfrp, int *row, int *col)
|
|||||||
frame_T *frp;
|
frame_T *frp;
|
||||||
int startcol;
|
int startcol;
|
||||||
int startrow;
|
int startrow;
|
||||||
|
int h;
|
||||||
|
|
||||||
wp = topfrp->fr_win;
|
wp = topfrp->fr_win;
|
||||||
if (wp != NULL)
|
if (wp != NULL)
|
||||||
@@ -4984,7 +4989,9 @@ frame_comp_pos(frame_T *topfrp, int *row, int *col)
|
|||||||
redraw_win_later(wp, NOT_VALID);
|
redraw_win_later(wp, NOT_VALID);
|
||||||
wp->w_redr_status = TRUE;
|
wp->w_redr_status = TRUE;
|
||||||
}
|
}
|
||||||
*row += wp->w_height + wp->w_status_height;
|
/* WinBar will not show if the window height is zero */
|
||||||
|
h = VISIBLE_HEIGHT(wp) + wp->w_status_height;
|
||||||
|
*row += h > topfrp->fr_height ? topfrp->fr_height : h;
|
||||||
*col += wp->w_width + wp->w_vsep_width;
|
*col += wp->w_width + wp->w_vsep_width;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -5029,6 +5036,7 @@ win_setheight_win(int height, win_T *win)
|
|||||||
height = p_wmh;
|
height = p_wmh;
|
||||||
if (height == 0)
|
if (height == 0)
|
||||||
height = 1;
|
height = 1;
|
||||||
|
height += WINBAR_HEIGHT(curwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_setheight(win->w_frame, height + win->w_status_height);
|
frame_setheight(win->w_frame, height + win->w_status_height);
|
||||||
@@ -5126,7 +5134,8 @@ frame_setheight(frame_T *curfrp, int height)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
room_cmdline = Rows - p_ch - (lastwin->w_winrow
|
room_cmdline = Rows - p_ch - (lastwin->w_winrow
|
||||||
+ lastwin->w_height + lastwin->w_status_height);
|
+ VISIBLE_HEIGHT(lastwin)
|
||||||
|
+ lastwin->w_status_height);
|
||||||
if (room_cmdline < 0)
|
if (room_cmdline < 0)
|
||||||
room_cmdline = 0;
|
room_cmdline = 0;
|
||||||
}
|
}
|
||||||
@@ -5415,7 +5424,7 @@ win_setminheight(void)
|
|||||||
/* TODO: handle vertical splits */
|
/* TODO: handle vertical splits */
|
||||||
room = -p_wh;
|
room = -p_wh;
|
||||||
FOR_ALL_WINDOWS(wp)
|
FOR_ALL_WINDOWS(wp)
|
||||||
room += wp->w_height - p_wmh;
|
room += VISIBLE_HEIGHT(wp) - p_wmh;
|
||||||
if (room >= 0)
|
if (room >= 0)
|
||||||
break;
|
break;
|
||||||
--p_wmh;
|
--p_wmh;
|
||||||
|
Reference in New Issue
Block a user