Mercurial > vim
comparison src/window.c @ 12916:af2e0401eb8c v8.0.1334
patch 8.0.1334: splitting a window with a WinBar damages window layout
commit https://github.com/vim/vim/commit/3167c3e7010ac7e2fd7d3aa198dd2d1dcff8ecc8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 25 14:19:43 2017 +0100
patch 8.0.1334: splitting a window with a WinBar damages window layout
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().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 25 Nov 2017 14:30:05 +0100 |
parents | d21adefd4a50 |
children | dd734ee3e2fe |
comparison
equal
deleted
inserted
replaced
12915:2b9a459263e2 | 12916:af2e0401eb8c |
---|---|
1096 if (flags & (WSP_TOP | WSP_BOT)) | 1096 if (flags & (WSP_TOP | WSP_BOT)) |
1097 { | 1097 { |
1098 /* set height and row of new window to full height */ | 1098 /* set height and row of new window to full height */ |
1099 wp->w_winrow = tabline_height(); | 1099 wp->w_winrow = tabline_height(); |
1100 win_new_height(wp, curfrp->fr_height - (p_ls > 0) | 1100 win_new_height(wp, curfrp->fr_height - (p_ls > 0) |
1101 #ifdef FEAT_MENU | 1101 - WINBAR_HEIGHT(wp)); |
1102 - wp->w_winbar_height | |
1103 #endif | |
1104 ); | |
1105 wp->w_status_height = (p_ls > 0); | 1102 wp->w_status_height = (p_ls > 0); |
1106 } | 1103 } |
1107 else | 1104 else |
1108 { | 1105 { |
1109 /* height and row of new window is same as current window */ | 1106 /* height and row of new window is same as current window */ |
1110 wp->w_winrow = oldwin->w_winrow; | 1107 wp->w_winrow = oldwin->w_winrow; |
1111 win_new_height(wp, oldwin->w_height | 1108 win_new_height(wp, oldwin->w_height + WINBAR_HEIGHT(oldwin)); |
1112 #ifdef FEAT_MENU | |
1113 + oldwin->w_winbar_height | |
1114 #endif | |
1115 ); | |
1116 wp->w_status_height = oldwin->w_status_height; | 1109 wp->w_status_height = oldwin->w_status_height; |
1117 } | 1110 } |
1118 frp->fr_height = curfrp->fr_height; | 1111 frp->fr_height = curfrp->fr_height; |
1119 | 1112 |
1120 /* "new_size" of the current window goes to the new window, use | 1113 /* "new_size" of the current window goes to the new window, use |
1169 * one row for the status line */ | 1162 * one row for the status line */ |
1170 win_new_height(wp, new_size); | 1163 win_new_height(wp, new_size); |
1171 if (flags & (WSP_TOP | WSP_BOT)) | 1164 if (flags & (WSP_TOP | WSP_BOT)) |
1172 { | 1165 { |
1173 int new_fr_height = curfrp->fr_height - new_size | 1166 int new_fr_height = curfrp->fr_height - new_size |
1174 #ifdef FEAT_MENU | 1167 + WINBAR_HEIGHT(wp) ; |
1175 + wp->w_winbar_height | |
1176 #endif | |
1177 ; | |
1178 | 1168 |
1179 if (!((flags & WSP_BOT) && p_ls == 0)) | 1169 if (!((flags & WSP_BOT) && p_ls == 0)) |
1180 new_fr_height -= STATUS_HEIGHT; | 1170 new_fr_height -= STATUS_HEIGHT; |
1181 frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE); | 1171 frame_new_height(curfrp, new_fr_height, flags & WSP_TOP, FALSE); |
1182 } | 1172 } |
1188 wp->w_status_height = STATUS_HEIGHT; | 1178 wp->w_status_height = STATUS_HEIGHT; |
1189 oldwin->w_winrow += wp->w_height + STATUS_HEIGHT; | 1179 oldwin->w_winrow += wp->w_height + STATUS_HEIGHT; |
1190 } | 1180 } |
1191 else /* new window below current one */ | 1181 else /* new window below current one */ |
1192 { | 1182 { |
1193 wp->w_winrow = oldwin->w_winrow + oldwin->w_height + STATUS_HEIGHT; | 1183 wp->w_winrow = oldwin->w_winrow + oldwin->w_height |
1184 + STATUS_HEIGHT + WINBAR_HEIGHT(oldwin); | |
1194 wp->w_status_height = oldwin->w_status_height; | 1185 wp->w_status_height = oldwin->w_status_height; |
1195 if (!(flags & WSP_BOT)) | 1186 if (!(flags & WSP_BOT)) |
1196 oldwin->w_status_height = STATUS_HEIGHT; | 1187 oldwin->w_status_height = STATUS_HEIGHT; |
1197 } | 1188 } |
1198 if (flags & WSP_BOT) | 1189 if (flags & WSP_BOT) |
2865 if (topfrp->fr_win != NULL) | 2856 if (topfrp->fr_win != NULL) |
2866 { | 2857 { |
2867 /* Simple case: just one window. */ | 2858 /* Simple case: just one window. */ |
2868 win_new_height(topfrp->fr_win, | 2859 win_new_height(topfrp->fr_win, |
2869 height - topfrp->fr_win->w_status_height | 2860 height - topfrp->fr_win->w_status_height |
2870 #ifdef FEAT_MENU | 2861 - WINBAR_HEIGHT(topfrp->fr_win)); |
2871 - topfrp->fr_win->w_winbar_height | |
2872 #endif | |
2873 ); | |
2874 } | 2862 } |
2875 else if (topfrp->fr_layout == FR_ROW) | 2863 else if (topfrp->fr_layout == FR_ROW) |
2876 { | 2864 { |
2877 do | 2865 do |
2878 { | 2866 { |
3215 */ | 3203 */ |
3216 static void | 3204 static void |
3217 frame_fix_height(win_T *wp) | 3205 frame_fix_height(win_T *wp) |
3218 { | 3206 { |
3219 wp->w_frame->fr_height = wp->w_height + wp->w_status_height | 3207 wp->w_frame->fr_height = wp->w_height + wp->w_status_height |
3220 #ifdef FEAT_MENU | 3208 + WINBAR_HEIGHT(wp) ; |
3221 + wp->w_winbar_height | |
3222 #endif | |
3223 ; | |
3224 } | 3209 } |
3225 | 3210 |
3226 /* | 3211 /* |
3227 * Compute the minimal height for frame "topfrp". | 3212 * Compute the minimal height for frame "topfrp". |
3228 * Uses the 'winminheight' option. | 3213 * Uses the 'winminheight' option. |