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>
This commit is contained in:
Milly
2024-11-28 18:16:55 +01:00
committed by Christian Brabandt
parent 511eb84c08
commit 2cddf0e85a
8 changed files with 66 additions and 14 deletions

View File

@ -3417,13 +3417,13 @@ did_set_cmdheight(optset_T *args)
char *errmsg = NULL;
// if p_ch changed value, change the command line height
if (p_ch < 1)
if (p_ch < MIN_CMDHEIGHT)
{
errmsg = e_argument_must_be_positive;
p_ch = 1;
p_ch = MIN_CMDHEIGHT;
}
if (p_ch > Rows - min_rows() + 1)
p_ch = Rows - min_rows() + 1;
if (p_ch > Rows - min_rows() + MIN_CMDHEIGHT)
p_ch = Rows - min_rows() + MIN_CMDHEIGHT;
// Only compute the new window layout when startup has been
// completed. Otherwise the frame sizes may be wrong.
@ -4859,15 +4859,15 @@ check_num_option_bounds(
size_t errbuflen,
char *errmsg)
{
if (Rows < min_rows() && full_screen)
if (Rows < min_rows_for_all_tabpages() && full_screen)
{
if (errbuf != NULL)
{
vim_snprintf(errbuf, errbuflen,
_(e_need_at_least_nr_lines), min_rows());
_(e_need_at_least_nr_lines), min_rows_for_all_tabpages());
errmsg = errbuf;
}
Rows = min_rows();
Rows = min_rows_for_all_tabpages();
}
if (Columns < MIN_COLUMNS && full_screen)
{