fix(ui): clamp 'cmdheight' for other tabpages on screen resize (#31419)

This commit is contained in:
zeertzjq
2024-12-02 10:05:49 +08:00
committed by GitHub
parent 8de1dc6923
commit 6cdcac4492
4 changed files with 80 additions and 13 deletions

View File

@@ -7065,17 +7065,17 @@ int last_stl_height(bool morewin)
}
/// Return the minimal number of rows that is needed on the screen to display
/// the current number of windows.
int min_rows(void)
/// the current number of windows for the given tab page.
int min_rows(tabpage_T *tp) FUNC_ATTR_NONNULL_ALL
{
if (firstwin == NULL) { // not initialized yet
return MIN_LINES;
}
int total = frame_minheight(curtab->tp_topframe, NULL);
int total = frame_minheight(tp->tp_topframe, NULL);
total += tabline_height() + global_stl_height();
if (p_ch > 0) {
total += 1; // count the room for the command line
if ((tp == curtab ? p_ch : tp->tp_ch_used) > 0) {
total++; // count the room for the command line
}
return total;
}
@@ -7091,12 +7091,12 @@ int min_rows_for_all_tabpages(void)
int total = 0;
FOR_ALL_TABS(tp) {
int n = frame_minheight(tp->tp_topframe, NULL);
if ((tp == curtab ? p_ch : tp->tp_ch_used) > 0) {
n++; // count the room for the command line
}
total = MAX(total, n);
}
total += tabline_height() + global_stl_height();
if (p_ch > 0) {
total += 1; // count the room for the command line
}
return total;
}