To: vim_dev@googlegroups.com Subject: Patch 8.0.1334 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1334 Problem: Splitting a window with a WinBar damages window layout. (Lifepillar) Solution: Take the winbar into account when computing the new window position. Add WINBAR_HEIGHT(). Files: src/vim.h, src/window.c *** ../vim-8.0.1333/src/vim.h 2017-11-19 20:34:54.882376757 +0100 --- src/vim.h 2017-11-25 13:52:36.170838067 +0100 *************** *** 1485,1490 **** --- 1485,1495 ---- #define MIN_COLUMNS 12 /* minimal columns for screen */ #define MIN_LINES 2 /* minimal lines for screen */ #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 + #else + # define WINBAR_HEIGHT(wp) 0 + #endif #define QF_WINHEIGHT 10 /* default height for quickfix window */ /* *** ../vim-8.0.1333/src/window.c 2017-11-22 22:22:06.737567427 +0100 --- src/window.c 2017-11-25 14:11:47.807558977 +0100 *************** *** 1098,1118 **** /* set height and row of new window to full height */ wp->w_winrow = tabline_height(); win_new_height(wp, curfrp->fr_height - (p_ls > 0) ! #ifdef FEAT_MENU ! - wp->w_winbar_height ! #endif ! ); wp->w_status_height = (p_ls > 0); } else { /* height and row of new window is same as current window */ wp->w_winrow = oldwin->w_winrow; ! win_new_height(wp, oldwin->w_height ! #ifdef FEAT_MENU ! + oldwin->w_winbar_height ! #endif ! ); wp->w_status_height = oldwin->w_status_height; } frp->fr_height = curfrp->fr_height; --- 1098,1111 ---- /* set height and row of new window to full height */ wp->w_winrow = tabline_height(); win_new_height(wp, curfrp->fr_height - (p_ls > 0) ! - WINBAR_HEIGHT(wp)); wp->w_status_height = (p_ls > 0); } else { /* 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)); wp->w_status_height = oldwin->w_status_height; } frp->fr_height = curfrp->fr_height; *************** *** 1171,1180 **** if (flags & (WSP_TOP | WSP_BOT)) { int new_fr_height = curfrp->fr_height - new_size ! #ifdef FEAT_MENU ! + wp->w_winbar_height ! #endif ! ; if (!((flags & WSP_BOT) && p_ls == 0)) new_fr_height -= STATUS_HEIGHT; --- 1164,1170 ---- if (flags & (WSP_TOP | WSP_BOT)) { int new_fr_height = curfrp->fr_height - new_size ! + WINBAR_HEIGHT(wp) ; if (!((flags & WSP_BOT) && p_ls == 0)) new_fr_height -= STATUS_HEIGHT; *************** *** 1190,1196 **** } else /* new window below current one */ { ! wp->w_winrow = oldwin->w_winrow + oldwin->w_height + STATUS_HEIGHT; wp->w_status_height = oldwin->w_status_height; if (!(flags & WSP_BOT)) oldwin->w_status_height = STATUS_HEIGHT; --- 1180,1187 ---- } else /* new window below current one */ { ! wp->w_winrow = oldwin->w_winrow + oldwin->w_height ! + STATUS_HEIGHT + WINBAR_HEIGHT(oldwin); wp->w_status_height = oldwin->w_status_height; if (!(flags & WSP_BOT)) oldwin->w_status_height = STATUS_HEIGHT; *************** *** 2867,2876 **** /* Simple case: just one window. */ win_new_height(topfrp->fr_win, height - topfrp->fr_win->w_status_height ! #ifdef FEAT_MENU ! - topfrp->fr_win->w_winbar_height ! #endif ! ); } else if (topfrp->fr_layout == FR_ROW) { --- 2858,2864 ---- /* Simple case: just one window. */ win_new_height(topfrp->fr_win, height - topfrp->fr_win->w_status_height ! - WINBAR_HEIGHT(topfrp->fr_win)); } else if (topfrp->fr_layout == FR_ROW) { *************** *** 3217,3226 **** frame_fix_height(win_T *wp) { wp->w_frame->fr_height = wp->w_height + wp->w_status_height ! #ifdef FEAT_MENU ! + wp->w_winbar_height ! #endif ! ; } /* --- 3205,3211 ---- frame_fix_height(win_T *wp) { wp->w_frame->fr_height = wp->w_height + wp->w_status_height ! + WINBAR_HEIGHT(wp) ; } /* *** ../vim-8.0.1333/src/version.c 2017-11-23 22:52:00.573675299 +0100 --- src/version.c 2017-11-25 14:12:23.471347532 +0100 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1334, /**/ -- If you put 7 of the most talented OSS developers in a room for a week and asked them to fix a bug in a spreadsheet program, in 1 week you'd have 2 new mail readers and a text-based web browser. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///