vim-patch: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)

https://code.google.com/p/vim/source/detail?r=v7-4-372
This commit is contained in:
André Twupack 2014-09-15 22:59:52 +02:00
parent 16fb7fa960
commit 781d129445
2 changed files with 29 additions and 22 deletions

View File

@ -223,7 +223,7 @@ static int included_patches[] = {
//375, //375,
//374, //374,
//373 NA //373 NA
//372, 372,
371, 371,
370, 370,
369, 369,

View File

@ -544,6 +544,8 @@ int win_split_ins(int size, int flags, win_T *new_wp, int 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;
@ -569,16 +571,20 @@ int win_split_ins(int size, int flags, win_T *new_wp, int 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.
if (flags & WSP_ROOM) wmw1 = (p_wmw == 0 ? 1 : p_wmw);
needed += p_wiw - p_wmw; needed = wmw1 + 1;
if (flags & WSP_ROOM) {
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) {
EMSG(_(e_noroom)); EMSG(_(e_noroom));
@ -586,13 +592,12 @@ int win_split_ins(int size, int flags, win_T *new_wp, int 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)
@ -627,17 +632,20 @@ int win_split_ins(int size, int flags, win_T *new_wp, int 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.
if (flags & WSP_ROOM) wmh1 = (p_wmh == 0 ? 1 : p_wmh);
needed += p_wh - p_wmh; needed = wmh1 + STATUS_HEIGHT;
if (flags & WSP_ROOM) {
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) {
EMSG(_(e_noroom)); EMSG(_(e_noroom));
@ -651,13 +659,12 @@ int win_split_ins(int size, int flags, win_T *new_wp, int 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)