patch 9.1.0892: the max value of 'tabheight' is limited by other tabpages
Problem: the max value of 'tabheight' is limited by other tabpages
Solution: Limit the maximum value of 'cmdheight' to the current tabpage only.
(Milly)
The Help says that cmdheight is local to the tab page, but says nothing
about the maximum value depending on the state of all tab pages. Users
may wonder why they can't increase cmdheight when there are still rows
available on the current tab page. This PR changes the behavior of
cmdheight so that its maximum value depends only on the state of the
current tab page.
Also, since magic numbers were embedded in various places with the
minimum value of cmdheight being 1, we defined a constant to make it
easier to understand.
closes: #16131
Signed-off-by: Milly <milly.ca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/window.c b/src/window.c
index f8a6907..23a52ef 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6667,7 +6667,7 @@
while (p_wmh > 0)
{
room = Rows - p_ch;
- needed = min_rows() - 1; // 1 was added for the cmdline
+ needed = min_rows_for_all_tabpages() - 1; // 1 was added for the cmdline
if (room >= needed)
break;
--p_wmh;
@@ -6826,7 +6826,7 @@
row = win_comp_pos();
screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
cmdline_row = row;
- p_ch = MAX(Rows - cmdline_row, 1);
+ p_ch = MAX(Rows - cmdline_row, MIN_CMDHEIGHT);
curtab->tp_ch_used = p_ch;
win_fix_scroll(TRUE);
@@ -7497,6 +7497,20 @@
int
min_rows(void)
{
+ if (firstwin == NULL) // not initialized yet
+ return MIN_LINES;
+
+ return frame_minheight(curtab->tp_topframe, NULL) + tabline_height()
+ + MIN_CMDHEIGHT;
+}
+
+/*
+ * Return the minimal number of rows that is needed on the screen to display
+ * the current number of windows for all tab pages.
+ */
+ int
+min_rows_for_all_tabpages(void)
+{
int total;
tabpage_T *tp;
int n;
@@ -7512,7 +7526,7 @@
total = n;
}
total += tabline_height();
- total += 1; // count the room for the command line
+ total += MIN_CMDHEIGHT;
return total;
}