Mercurial > vim
changeset 12998:dd734ee3e2fe v8.0.1375
patch 8.0.1375: window size wrong after maximizing with WinBar
commit https://github.com/vim/vim/commit/415a6939a4e8d4e26b4af26c24eb75243d3a2756
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 5 20:31:07 2017 +0100
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 05 Dec 2017 20:45:05 +0100 |
parents | f0c85ce3dd06 |
children | 933cf0c7fb9c |
files | src/screen.c src/version.c src/vim.h src/window.c |
diffstat | 4 files changed, 28 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/screen.c +++ b/src/screen.c @@ -1154,7 +1154,7 @@ win_update(win_T *wp) } /* 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; return;
--- a/src/version.c +++ b/src/version.c @@ -772,6 +772,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1375, +/**/ 1374, /**/ 1373,
--- a/src/vim.h +++ b/src/vim.h @@ -1478,8 +1478,10 @@ typedef UINT32_TYPEDEF UINT32_T; #define STATUS_HEIGHT 1 /* 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 VISIBLE_HEIGHT(wp) ((wp)->w_height + (wp)->w_winbar_height) #else # define WINBAR_HEIGHT(wp) 0 +# define VISIBLE_HEIGHT(wp) (wp)->w_height #endif #define QF_WINHEIGHT 10 /* default height for quickfix window */
--- a/src/window.c +++ b/src/window.c @@ -782,7 +782,7 @@ win_split_ins( /* 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 (oldwin->w_height <= p_wmh && new_wp == NULL) + if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL) { EMSG(_(e_noroom)); return FAIL; @@ -892,7 +892,7 @@ win_split_ins( * height. */ /* 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; if (flags & WSP_ROOM) needed += p_wh - wmh1; @@ -1105,7 +1105,7 @@ win_split_ins( { /* height and row of new window is same as current window */ 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; } frp->fr_height = curfrp->fr_height; @@ -1180,8 +1180,8 @@ win_split_ins( } else /* new window below current one */ { - wp->w_winrow = oldwin->w_winrow + oldwin->w_height - + STATUS_HEIGHT + WINBAR_HEIGHT(oldwin); + wp->w_winrow = oldwin->w_winrow + VISIBLE_HEIGHT(oldwin) + + STATUS_HEIGHT; wp->w_status_height = oldwin->w_status_height; if (!(flags & WSP_BOT)) oldwin->w_status_height = STATUS_HEIGHT; @@ -1422,7 +1422,7 @@ make_windows( else { /* 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); } @@ -3204,8 +3204,7 @@ frame_fix_width(win_T *wp) static void frame_fix_height(win_T *wp) { - wp->w_frame->fr_height = wp->w_height + wp->w_status_height - + WINBAR_HEIGHT(wp) ; + wp->w_frame->fr_height = VISIBLE_HEIGHT(wp) + wp->w_status_height; } /* @@ -3230,9 +3229,14 @@ frame_minheight(frame_T *topfrp, win_T * { /* window: minimal height of the window plus status line */ m = p_wmh + topfrp->fr_win->w_status_height; - /* Current window is minimal one line high */ - if (p_wmh == 0 && topfrp->fr_win == curwin && next_curwin == NULL) - ++m; + if (topfrp->fr_win == curwin && next_curwin == NULL) + { + /* 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) @@ -4972,6 +4976,7 @@ frame_comp_pos(frame_T *topfrp, int *row frame_T *frp; int startcol; int startrow; + int h; wp = topfrp->fr_win; if (wp != NULL) @@ -4984,7 +4989,9 @@ frame_comp_pos(frame_T *topfrp, int *row redraw_win_later(wp, NOT_VALID); 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; } else @@ -5029,6 +5036,7 @@ win_setheight_win(int height, win_T *win height = p_wmh; if (height == 0) height = 1; + height += WINBAR_HEIGHT(curwin); } frame_setheight(win->w_frame, height + win->w_status_height); @@ -5126,7 +5134,8 @@ frame_setheight(frame_T *curfrp, int hei else { 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) room_cmdline = 0; } @@ -5415,7 +5424,7 @@ win_setminheight(void) /* TODO: handle vertical splits */ room = -p_wh; FOR_ALL_WINDOWS(wp) - room += wp->w_height - p_wmh; + room += VISIBLE_HEIGHT(wp) - p_wmh; if (room >= 0) break; --p_wmh;