mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(ui): allow resize commands to set 'cmdheight' to 0
Resolve https://github.com/neovim/neovim/issues/21558
This commit is contained in:
@@ -2280,6 +2280,8 @@ static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf,
|
||||
int minval = 0;
|
||||
if (value < minval) {
|
||||
errmsg = e_positive;
|
||||
} else {
|
||||
p_ch_was_zero = value == 0;
|
||||
}
|
||||
} else if (pp == &p_tm) {
|
||||
if (value < 0) {
|
||||
|
@@ -5758,8 +5758,8 @@ static void frame_setheight(frame_T *curfrp, int 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
|
||||
// `cmdheight` doesn't go below 1.
|
||||
height = (int)MIN((p_ch > 0 ? ROWS_AVAIL + (p_ch - 1) : ROWS_AVAIL), height);
|
||||
// `cmdheight` doesn't go below 1 if it wasn't set to 0 explicitly.
|
||||
height = (int)MIN(ROWS_AVAIL + p_ch - !p_ch_was_zero, height);
|
||||
}
|
||||
if (height > 0) {
|
||||
frame_new_height(curfrp, height, false, false);
|
||||
@@ -6090,8 +6090,6 @@ void win_setminwidth(void)
|
||||
/// Status line of dragwin is dragged "offset" lines down (negative is up).
|
||||
void win_drag_status_line(win_T *dragwin, int offset)
|
||||
{
|
||||
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) {
|
||||
|
@@ -35,6 +35,8 @@
|
||||
#define MIN_COLUMNS 12 // minimal columns for screen
|
||||
#define MIN_LINES 2 // minimal lines for screen
|
||||
|
||||
// Set to true if 'cmdheight' was explicitly set to 0.
|
||||
EXTERN bool p_ch_was_zero INIT(= false);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "window.h.generated.h"
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user