0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.4.372

Problem:    When 'winminheight' is zero there might not be one line for the
            current window.
Solution:   Change the size computations. (Yukihiro Nakadaira)
This commit is contained in:
Bram Moolenaar
2014-07-16 18:19:27 +02:00
parent 5524aebf16
commit 1f538355db
2 changed files with 24 additions and 20 deletions

View File

@@ -734,6 +734,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 */
/**/
372,
/**/ /**/
371, 371,
/**/ /**/

View File

@@ -688,6 +688,8 @@ win_split_ins(size, flags, new_wp, dir)
int before; int before;
int minwidth; int minwidth;
int minheight; int minheight;
int wmw1;
int wmh1;
if (flags & WSP_TOP) if (flags & WSP_TOP)
oldwin = firstwin; oldwin = firstwin;
@@ -722,19 +724,22 @@ win_split_ins(size, flags, new_wp, dir)
* Check if we are able to split the current window and compute its * Check if we are able to split the current window and compute its
* width. * width.
*/ */
needed = p_wmw + 1; /* Current window requires at least 1 space. */
wmw1 = (p_wmw == 0 ? 1 : p_wmw);
needed = wmw1 + 1;
if (flags & WSP_ROOM) if (flags & WSP_ROOM)
needed += p_wiw - p_wmw; needed += p_wiw - wmw1;
if (p_ea || (flags & (WSP_BOT | WSP_TOP))) if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
{ {
minwidth = frame_minwidth(topframe, NULL); minwidth = frame_minwidth(topframe, NOWIN);
available = topframe->fr_width; available = topframe->fr_width;
needed += minwidth; needed += minwidth;
} }
else else
{ {
minwidth = frame_minwidth(oldwin->w_frame, NULL); minwidth = frame_minwidth(oldwin->w_frame, NOWIN);
available = oldwin->w_width; available = oldwin->w_frame->fr_width;
needed += minwidth;
} }
if (available < needed && new_wp == NULL) if (available < needed && new_wp == NULL)
{ {
@@ -743,12 +748,10 @@ win_split_ins(size, flags, new_wp, dir)
} }
if (new_size == 0) if (new_size == 0)
new_size = oldwin->w_width / 2; new_size = oldwin->w_width / 2;
if (new_size > oldwin->w_width - p_wmw - 1)
new_size = oldwin->w_width - p_wmw - 1;
if (new_size > available - minwidth - 1) if (new_size > available - minwidth - 1)
new_size = available - minwidth - 1; new_size = available - minwidth - 1;
if (new_size < p_wmw) if (new_size < wmw1)
new_size = p_wmw; 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)
@@ -789,20 +792,22 @@ win_split_ins(size, flags, new_wp, dir)
* Check if we are able to split the current window and compute its * Check if we are able to split the current window and compute its
* height. * height.
*/ */
needed = p_wmh + STATUS_HEIGHT + need_status; /* Current window requires at least 1 space. */
wmh1 = (p_wmh == 0 ? 1 : p_wmh);
needed = wmh1 + STATUS_HEIGHT;
if (flags & WSP_ROOM) if (flags & WSP_ROOM)
needed += p_wh - p_wmh; needed += p_wh - wmh1;
if (p_ea || (flags & (WSP_BOT | WSP_TOP))) if (p_ea || (flags & (WSP_BOT | WSP_TOP)))
{ {
minheight = frame_minheight(topframe, NULL); minheight = frame_minheight(topframe, NOWIN) + need_status;
available = topframe->fr_height; available = topframe->fr_height;
needed += minheight; needed += minheight;
} }
else else
{ {
minheight = frame_minheight(oldwin->w_frame, NULL); minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;
available = oldwin->w_height; available = oldwin->w_frame->fr_height;
needed += p_wmh; needed += minheight;
} }
if (available < needed && new_wp == NULL) if (available < needed && new_wp == NULL)
{ {
@@ -817,13 +822,10 @@ win_split_ins(size, flags, new_wp, dir)
} }
if (new_size == 0) if (new_size == 0)
new_size = oldwin_height / 2; new_size = oldwin_height / 2;
if (new_size > oldwin_height - p_wmh - STATUS_HEIGHT)
new_size = oldwin_height - p_wmh - STATUS_HEIGHT;
if (new_size > available - minheight - STATUS_HEIGHT) if (new_size > available - minheight - STATUS_HEIGHT)
new_size = available - minheight - STATUS_HEIGHT; new_size = available - minheight - STATUS_HEIGHT;
if (new_size < p_wmh) if (new_size < wmh1)
new_size = p_wmh; 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)