aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-12-02 10:05:49 +0800
committerGitHub <noreply@github.com>2024-12-02 10:05:49 +0800
commit6cdcac4492cc33b4360dfbb93fa2b04d9f771494 (patch)
tree2ff24bcdba06b7da047471d370b9c751731ac6fa /src/nvim/window.c
parent8de1dc6923396b46c327a31daa8a1562a196a255 (diff)
downloadrneovim-6cdcac4492cc33b4360dfbb93fa2b04d9f771494.tar.gz
rneovim-6cdcac4492cc33b4360dfbb93fa2b04d9f771494.tar.bz2
rneovim-6cdcac4492cc33b4360dfbb93fa2b04d9f771494.zip
fix(ui): clamp 'cmdheight' for other tabpages on screen resize (#31419)
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index d92b2ab601..79c3ce9304 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -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;
}