Merge pull request #1168 from atwupack/vp-7.4.365

vim-patch:7.4.365, 7.4.372, 7.4.373, 7.4.377
This commit is contained in:
Justin M. Keyes 2014-09-18 17:20:44 -04:00
commit 39882b85b6
2 changed files with 80 additions and 27 deletions

View File

@ -218,19 +218,19 @@ static int included_patches[] = {
//380 NA //380 NA
//379, //379,
//378, //378,
//377, 377,
376, 376,
//375, //375,
//374, //374,
//373 NA 373,
//372, 372,
371, 371,
370, 370,
369, 369,
368, 368,
367, 367,
//366, //366,
//365, 365,
//364, //364,
//363, //363,
362, 362,

View File

@ -540,8 +540,10 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
int available; int available;
int oldwin_height = 0; int oldwin_height = 0;
int layout; int layout;
frame_T *frp, *curfrp; frame_T *frp, *curfrp, *frp2, *prevfrp;
int before; int before;
int minheight;
int wmh1;
if (flags & WSP_TOP) if (flags & WSP_TOP)
oldwin = firstwin; oldwin = firstwin;
@ -561,30 +563,58 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
if (flags & WSP_VERT) { if (flags & WSP_VERT) {
int wmw1;
int minwidth;
layout = FR_ROW; layout = FR_ROW;
/* /*
* 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 (p_ea || (flags & (WSP_BOT | WSP_TOP))) { if (flags & WSP_ROOM) {
needed += p_wiw - wmw1;
}
if (flags & (WSP_BOT | WSP_TOP)) {
minwidth = frame_minwidth(topframe, NOWIN);
available = topframe->fr_width; available = topframe->fr_width;
needed += frame_minwidth(topframe, NULL); needed += minwidth;
} else } else if (p_ea) {
available = oldwin->w_width; minwidth = frame_minwidth(oldwin->w_frame, NOWIN);
prevfrp = oldwin->w_frame;
for (frp = oldwin->w_frame->fr_parent; frp != NULL;
frp = frp->fr_parent) {
if (frp->fr_layout == FR_ROW) {
for (frp2 = frp->fr_child; frp2 != NULL; frp2 = frp2->fr_next) {
if (frp2 != prevfrp) {
minwidth += frame_minwidth(frp2, NOWIN);
}
}
}
prevfrp = frp;
}
available = topframe->fr_width;
needed += minwidth;
} else {
minwidth = frame_minwidth(oldwin->w_frame, NOWIN);
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));
return FAIL; return FAIL;
} }
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) if (new_size > available - minwidth - 1) {
new_size = oldwin->w_width - p_wmw - 1; new_size = available - minwidth - 1;
if (new_size < p_wmw) }
new_size = p_wmw; if (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)
@ -619,15 +649,36 @@ 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 (p_ea || (flags & (WSP_BOT | WSP_TOP))) { if (flags & WSP_ROOM) {
needed += p_wh - wmh1;
}
if (flags & (WSP_BOT | WSP_TOP)) {
minheight = frame_minheight(topframe, NOWIN) + need_status;
available = topframe->fr_height; available = topframe->fr_height;
needed += frame_minheight(topframe, NULL); needed += minheight;
} else if (p_ea) {
minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;
prevfrp = oldwin->w_frame;
for (frp = oldwin->w_frame->fr_parent; frp != NULL;
frp = frp->fr_parent) {
if (frp->fr_layout == FR_COL) {
for (frp2 = frp->fr_child; frp2 != NULL; frp2 = frp2->fr_next) {
if (frp2 != prevfrp) {
minheight += frame_minheight(frp2, NOWIN);
}
}
}
prevfrp = frp;
}
available = topframe->fr_height;
needed += minheight;
} else { } else {
available = oldwin->w_height; minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status;
needed += p_wmh; available = oldwin->w_frame->fr_height;
needed += minheight;
} }
if (available < needed && new_wp == NULL) { if (available < needed && new_wp == NULL) {
EMSG(_(e_noroom)); EMSG(_(e_noroom));
@ -641,10 +692,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) if (new_size > available - minheight - STATUS_HEIGHT) {
new_size = oldwin_height - p_wmh - STATUS_HEIGHT; new_size = available - minheight - STATUS_HEIGHT;
if (new_size < p_wmh) }
new_size = p_wmh; if (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)