diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/drawscreen.c | 2 | ||||
-rw-r--r-- | src/nvim/option.c | 7 | ||||
-rw-r--r-- | src/nvim/window.c | 18 |
3 files changed, 22 insertions, 5 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index e645d1bbea..835fdcf7d0 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -396,7 +396,7 @@ void check_screensize(void) { // Limit Rows and Columns to avoid an overflow in Rows * Columns. // need room for one window and command line - Rows = MIN(MAX(Rows, min_rows()), 1000); + Rows = MIN(MAX(Rows, min_rows_for_all_tabpages()), 1000); Columns = MIN(MAX(Columns, MIN_COLUMNS), 10000); } diff --git a/src/nvim/option.c b/src/nvim/option.c index 27b80c0ac8..6da9635479 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -2764,10 +2764,11 @@ static const char *check_num_option_bounds(OptIndex opt_idx, OptInt *newval, cha switch (opt_idx) { case kOptLines: - if (*newval < min_rows() && full_screen) { - vim_snprintf(errbuf, errbuflen, _("E593: Need at least %d lines"), min_rows()); + if (*newval < min_rows_for_all_tabpages() && full_screen) { + vim_snprintf(errbuf, errbuflen, _("E593: Need at least %d lines"), + min_rows_for_all_tabpages()); errmsg = errbuf; - *newval = min_rows(); + *newval = min_rows_for_all_tabpages(); } // True max size is defined by check_screensize(). *newval = MIN(*newval, INT_MAX); diff --git a/src/nvim/window.c b/src/nvim/window.c index ac4c5a8e4a..d92b2ab601 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -6189,7 +6189,7 @@ const char *did_set_winminheight(optset_T *args FUNC_ATTR_UNUSED) // loop until there is a 'winminheight' that is possible while (p_wmh > 0) { const int room = Rows - (int)p_ch; - const int needed = min_rows(); + const int needed = min_rows_for_all_tabpages(); if (room >= needed) { break; } @@ -7072,6 +7072,22 @@ int min_rows(void) return MIN_LINES; } + int total = frame_minheight(curtab->tp_topframe, NULL); + total += tabline_height() + global_stl_height(); + if (p_ch > 0) { + total += 1; // count the room for the command line + } + return total; +} + +/// 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) +{ + if (firstwin == NULL) { // not initialized yet + return MIN_LINES; + } + int total = 0; FOR_ALL_TABS(tp) { int n = frame_minheight(tp->tp_topframe, NULL); |