aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-17 10:19:16 +0800
committerGitHub <noreply@github.com>2022-08-17 10:19:16 +0800
commit5c1eb02b05cd2e8cac330c85a2492846b2e4990d (patch)
treea503a2989c51957a6e6e53eda62430784572b6b7 /src/nvim/window.c
parentd74f9c3b947677a98103c41e0c4ad8ae54389c4e (diff)
parent9a6d3bd76e1edcedf71f31dfa5e1600c1c5d2c3a (diff)
downloadrneovim-5c1eb02b05cd2e8cac330c85a2492846b2e4990d.tar.gz
rneovim-5c1eb02b05cd2e8cac330c85a2492846b2e4990d.tar.bz2
rneovim-5c1eb02b05cd2e8cac330c85a2492846b2e4990d.zip
Merge pull request #19801 from Shougo/vim-9.0.0190
vim-patch:9.0.{0190,0191,0192}: cmdheight=0 fixes
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 9fddc59699..b17245dd3d 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5552,7 +5552,7 @@ static void frame_setheight(frame_T *curfrp, int height)
}
if (curfrp->fr_parent == NULL) {
- // topframe: can only change the command line
+ // topframe: can only change the command line height
if (height > ROWS_AVAIL) {
// If height is greater than the available space, try to create space for
// the frame by reducing 'cmdheight' if possible, while making sure
@@ -5915,6 +5915,13 @@ void win_drag_status_line(win_T *dragwin, int offset)
int row;
bool up; // if true, drag status line up, otherwise down
int n;
+ static bool p_ch_was_zero = false;
+
+ // If the user explicitly set 'cmdheight' to zero, then allow for dragging
+ // the status line making it zero again.
+ if (p_ch == 0) {
+ p_ch_was_zero = true;
+ }
fr = dragwin->w_frame;
curfr = fr;
@@ -5965,6 +5972,8 @@ void win_drag_status_line(win_T *dragwin, int offset)
room = Rows - cmdline_row;
if (curfr->fr_next != NULL) {
room -= (int)p_ch + global_stl_height();
+ } else if (!p_ch_was_zero) {
+ room--;
}
if (room < 0) {
room = 0;
@@ -6020,7 +6029,7 @@ void win_drag_status_line(win_T *dragwin, int offset)
clear_cmdline = true;
}
cmdline_row = row;
- p_ch = MAX(Rows - cmdline_row, 0);
+ p_ch = MAX(Rows - cmdline_row, p_ch_was_zero ? 0 : 1);
curtab->tp_ch_used = p_ch;
redraw_all_later(SOME_VALID);
showmode();
@@ -6384,6 +6393,19 @@ void command_height(void)
// p_ch was changed in another tab page.
curtab->tp_ch_used = p_ch;
+ // If the space for the command line is already more than 'cmdheight' there
+ // is nothing to do (window size must have decreased).
+ if (p_ch > old_p_ch && cmdline_row <= Rows - p_ch) {
+ return;
+ }
+
+ // If cmdline_row is smaller than what it is supposed to be for 'cmdheight'
+ // then set old_p_ch to what it would be, so that the windows get resized
+ // properly for the new value.
+ if (cmdline_row < Rows - p_ch) {
+ old_p_ch = Rows - cmdline_row;
+ }
+
// Find bottom frame with width of screen.
frp = lastwin_nofloating()->w_frame;
while (frp->fr_width != Columns && frp->fr_parent != NULL) {