diff options
author | André Twupack <atwupack@mailbox.org> | 2014-09-16 20:59:10 +0200 |
---|---|---|
committer | André Twupack <atwupack@mailbox.org> | 2014-09-18 22:34:55 +0200 |
commit | f379b4474713d481dafde23a7f00d9fda3314598 (patch) | |
tree | 520fe801a7b65758027635c56cbd74b442be6ef4 /src | |
parent | ab4feeac8227386428196445aa9036b9f5523ae6 (diff) | |
download | rneovim-f379b4474713d481dafde23a7f00d9fda3314598.tar.gz rneovim-f379b4474713d481dafde23a7f00d9fda3314598.tar.bz2 rneovim-f379b4474713d481dafde23a7f00d9fda3314598.zip |
vim-patch:7.4.377
Problem: When 'equalalways' is set a split may report "no room" even though
there is plenty of room.
Solution: Compute the available room properly. (Yukihiro Nakadaira)
https://code.google.com/p/vim/source/detail?r=v7-4-377
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 38 |
2 files changed, 36 insertions, 4 deletions
diff --git a/src/nvim/version.c b/src/nvim/version.c index 57634f49c1..81a018470a 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -218,7 +218,7 @@ static int included_patches[] = { //380 NA //379, //378, - //377, + 377, 376, //375, //374, diff --git a/src/nvim/window.c b/src/nvim/window.c index 38f61ee45e..f5d8edc751 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -540,7 +540,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir) int available; int oldwin_height = 0; int layout; - frame_T *frp, *curfrp; + frame_T *frp, *curfrp, *frp2, *prevfrp; int before; int minheight; int wmh1; @@ -578,10 +578,26 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir) if (flags & WSP_ROOM) { needed += p_wiw - wmw1; } - if (p_ea || (flags & (WSP_BOT | WSP_TOP))) { + if (flags & (WSP_BOT | WSP_TOP)) { minwidth = frame_minwidth(topframe, NOWIN); available = topframe->fr_width; needed += minwidth; + } else if (p_ea) { + 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; @@ -639,10 +655,26 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir) if (flags & WSP_ROOM) { needed += p_wh - wmh1; } - if (p_ea || (flags & (WSP_BOT | WSP_TOP))) { + if (flags & (WSP_BOT | WSP_TOP)) { minheight = frame_minheight(topframe, NOWIN) + need_status; available = topframe->fr_height; 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 { minheight = frame_minheight(oldwin->w_frame, NOWIN) + need_status; available = oldwin->w_frame->fr_height; |