1
0
forked from aniani/vim

patch 9.0.0340: the 'cmdheight' zero support causes too much trouble

Problem:    The 'cmdheight' zero support causes too much trouble.
Solution:   Revert support for 'cmdheight' being zero.
This commit is contained in:
Bram Moolenaar 2022-08-31 14:46:18 +01:00
parent a63ad78ed3
commit a2a8973e51
32 changed files with 46 additions and 404 deletions

View File

@ -1783,18 +1783,11 @@ A jump table for the options with a short description can be found at |Q_op|.
*'cmdheight'* *'ch'* *'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1) 'cmdheight' 'ch' number (default 1)
global or local to tab page global or local to tab page
Number of screen lines to use for the command-line. Helps avoiding Number of screen lines to use for the command-line. A larger value
|hit-enter| prompts. helps avoiding |hit-enter| prompts.
The value of this option is stored with the tab page, so that each tab The value of this option is stored with the tab page, so that each tab
page can have a different value. page can have a different value.
When 'cmdheight' is zero, there is no command-line unless it is being
used. Informative messages will be displayed in a popup notification
window at the bottom if the window, using the MessageWindow highlight
group {only if compiled with the +popupwin and +timers features},
otherwise they will not be displayed. Other messages will cause the
|hit-enter| prompt. Expect some other unexpected behavior too.
*'cmdwinheight'* *'cwh'* *'cmdwinheight'* *'cwh'*
'cmdwinheight' 'cwh' number (default 7) 'cmdwinheight' 'cwh' number (default 7)
global global
@ -6474,11 +6467,9 @@ A jump table for the options with a short description can be found at |Q_op|.
45% relative position in the file 45% relative position in the file
If 'rulerformat' is set, it will determine the contents of the ruler. If 'rulerformat' is set, it will determine the contents of the ruler.
Each window has its own ruler. If a window has a status line, the Each window has its own ruler. If a window has a status line, the
ruler is shown there. If a window doesn't have a status line and ruler is shown there. Otherwise it is shown in the last line of the
'cmdheight' is zero, the ruler is not shown. Otherwise it is shown in screen. If the statusline is given by 'statusline' (i.e. not empty),
the last line of the screen. If the statusline is given by this option takes precedence over 'ruler' and 'rulerformat'.
'statusline' (i.e. not empty), this option takes precedence over
'ruler' and 'rulerformat'.
If the number of characters displayed is different from the number of If the number of characters displayed is different from the number of
bytes in the text (e.g., for a TAB or a multibyte character), both bytes in the text (e.g., for a TAB or a multibyte character), both
the text column (byte number) and the screen column are shown, the text column (byte number) and the screen column are shown,
@ -7128,7 +7119,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|+cmdline_info| feature} |+cmdline_info| feature}
Show (partial) command in the last line of the screen. Set this Show (partial) command in the last line of the screen. Set this
option off if your terminal is slow. option off if your terminal is slow.
The option has no effect when 'cmdheight' is zero.
In Visual mode the size of the selected area is shown: In Visual mode the size of the selected area is shown:
- When selecting characters within a line, the number of characters. - When selecting characters within a line, the number of characters.
If the number of bytes is different it is also displayed: "2-6" If the number of bytes is different it is also displayed: "2-6"
@ -7178,7 +7168,6 @@ A jump table for the options with a short description can be found at |Q_op|.
If in Insert, Replace or Visual mode put a message on the last line. If in Insert, Replace or Visual mode put a message on the last line.
Use the 'M' flag in 'highlight' to set the type of highlighting for Use the 'M' flag in 'highlight' to set the type of highlighting for
this message. this message.
The option has no effect when 'cmdheight' is zero.
When |XIM| may be used the message will include "XIM". But this When |XIM| may be used the message will include "XIM". But this
doesn't mean XIM is really active, especially when 'imactivatekey' is doesn't mean XIM is really active, especially when 'imactivatekey' is
not set. not set.

View File

@ -654,8 +654,8 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
int off = 0; int off = 0;
int width; int width;
// If 'ruler' off or messages area disabled, don't do anything // If 'ruler' off don't do anything
if (!p_ru || (wp->w_status_height == 0 && p_ch == 0)) if (!p_ru)
return; return;
/* /*
@ -676,7 +676,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
return; return;
#ifdef FEAT_STL_OPT #ifdef FEAT_STL_OPT
if (*p_ruf && p_ch > 0) if (*p_ruf)
{ {
int called_emsg_before = called_emsg; int called_emsg_before = called_emsg;
@ -1814,13 +1814,9 @@ win_update(win_T *wp)
// Move the entries that were scrolled, disable // Move the entries that were scrolled, disable
// the entries for the lines to be redrawn. // the entries for the lines to be redrawn.
// Avoid using a wrong index when 'cmdheight' is
// zero and wp->w_height == Rows.
if ((wp->w_lines_valid += j) > wp->w_height) if ((wp->w_lines_valid += j) > wp->w_height)
wp->w_lines_valid = wp->w_height; wp->w_lines_valid = wp->w_height;
for (idx = wp->w_lines_valid >= wp->w_height for (idx = wp->w_lines_valid; idx - j >= 0; idx--)
? wp->w_height - 1 : wp->w_lines_valid;
idx - j >= 0; idx--)
wp->w_lines[idx] = wp->w_lines[idx - j]; wp->w_lines[idx] = wp->w_lines[idx - j];
while (idx >= 0) while (idx >= 0)
wp->w_lines[idx--].wl_valid = FALSE; wp->w_lines[idx--].wl_valid = FALSE;
@ -2420,8 +2416,7 @@ win_update(win_T *wp)
if (wp->w_lines_valid > wp->w_height) if (wp->w_lines_valid > wp->w_height)
wp->w_lines_valid = wp->w_height; wp->w_lines_valid = wp->w_height;
for (i = wp->w_lines_valid; i - j >= idx; --i) for (i = wp->w_lines_valid; i - j >= idx; --i)
if (i < Rows) wp->w_lines[i] = wp->w_lines[i - j];
wp->w_lines[i] = wp->w_lines[i - j];
// The w_lines[] entries for inserted lines are // The w_lines[] entries for inserted lines are
// now invalid, but wl_size may be used above. // now invalid, but wl_size may be used above.
@ -2502,8 +2497,7 @@ win_update(win_T *wp)
// Past end of the window or end of the screen. Note that after // Past end of the window or end of the screen. Note that after
// resizing wp->w_height may be end up too big. That's a problem // resizing wp->w_height may be end up too big. That's a problem
// elsewhere, but prevent a crash here. // elsewhere, but prevent a crash here.
if (row > wp->w_height if (row > wp->w_height || row + wp->w_winrow >= Rows)
|| row + wp->w_winrow >= (p_ch > 0 ? Rows : Rows + 1))
{ {
// we may need the size of that too long line later on // we may need the size of that too long line later on
if (dollar_vcol == -1) if (dollar_vcol == -1)
@ -2557,7 +2551,7 @@ win_update(win_T *wp)
// Safety check: if any of the wl_size values is wrong we might go over // Safety check: if any of the wl_size values is wrong we might go over
// the end of w_lines[]. // the end of w_lines[].
if (idx >= (p_ch > 0 ? Rows : Rows + 1)) if (idx >= Rows)
break; break;
} }
@ -2945,8 +2939,7 @@ redraw_asap(int type)
redraw_later(type); redraw_later(type);
if (msg_scrolled if (msg_scrolled
|| (State != MODE_NORMAL && State != MODE_NORMAL_BUSY) || (State != MODE_NORMAL && State != MODE_NORMAL_BUSY)
|| exiting || exiting)
|| p_ch == 0)
return ret; return ret;
// Allocate space to save the text displayed in the command line area. // Allocate space to save the text displayed in the command line area.

View File

@ -6832,17 +6832,18 @@ ex_execute(exarg_T *eap)
if (eap->skip) if (eap->skip)
--emsg_skip; --emsg_skip;
#ifdef HAS_MESSAGE_WINDOW #ifdef HAS_MESSAGE_WINDOW
if (use_message_window() && eap->cmdidx != CMD_execute) if (eap->cmdidx == CMD_echowindow)
{ {
// show the message window now // show the message window now
ex_redraw(eap); ex_redraw(eap);
// do not overwrite messages // do not overwrite messages
// TODO: only for message window
msg_didout = TRUE; msg_didout = TRUE;
if (msg_col == 0) if (msg_col == 0)
msg_col = 1; msg_col = 1;
in_echowindow = FALSE;
} }
in_echowindow = FALSE;
#endif #endif
set_nextcmd(eap, arg); set_nextcmd(eap, arg);
} }

View File

@ -1011,7 +1011,6 @@ do_bang(
if (addr_count == 0) // :! if (addr_count == 0) // :!
{ {
// echo the command // echo the command
dont_use_message_window();
msg_start(); msg_start();
msg_putchar(':'); msg_putchar(':');
msg_putchar('!'); msg_putchar('!');
@ -3702,7 +3701,6 @@ ex_substitute(exarg_T *eap)
int endcolumn = FALSE; // cursor in last column when done int endcolumn = FALSE; // cursor in last column when done
pos_T old_cursor = curwin->w_cursor; pos_T old_cursor = curwin->w_cursor;
int start_nsubs; int start_nsubs;
int cmdheight0 = p_ch == 0;
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
int save_ma = 0; int save_ma = 0;
int save_sandbox = 0; int save_sandbox = 0;
@ -4012,14 +4010,6 @@ ex_substitute(exarg_T *eap)
} }
} }
if (cmdheight0)
{
// If cmdheight is 0, cmdheight must be set to 1 when we enter command
// line.
set_option_value((char_u *)"ch", 1L, NULL, 0);
redraw_statuslines();
}
/* /*
* Check for a match on each line. * Check for a match on each line.
*/ */
@ -4902,10 +4892,6 @@ outofmem:
changed_window_setting(); changed_window_setting();
#endif #endif
// Restore cmdheight
if (cmdheight0)
set_option_value((char_u *)"ch", 0L, NULL, 0);
vim_regfree(regmatch.regprog); vim_regfree(regmatch.regprog);
vim_free(sub_copy); vim_free(sub_copy);

View File

@ -8370,14 +8370,9 @@ ex_redraw(exarg_T *eap)
// After drawing the statusline screen_attr may still be set. // After drawing the statusline screen_attr may still be set.
screen_stop_highlight(); screen_stop_highlight();
#ifdef HAS_MESSAGE_WINDOW // Reset msg_didout, so that a message that's there is overwritten.
if (!use_message_window()) // append messages in the message window msg_didout = FALSE;
#endif msg_col = 0;
{
// Reset msg_didout, so that a message that's there is overwritten.
msg_didout = FALSE;
msg_col = 0;
}
// No need to wait after an intentional redraw. // No need to wait after an intentional redraw.
need_wait_return = FALSE; need_wait_return = FALSE;

View File

@ -1591,25 +1591,6 @@ getcmdline_int(
int did_save_ccline = FALSE; int did_save_ccline = FALSE;
int cmdline_type; int cmdline_type;
int wild_type; int wild_type;
int cmdheight0 = p_ch == 0;
if (cmdheight0)
{
int save_so = lastwin->w_p_so;
// If cmdheight is 0, cmdheight must be set to 1 when we enter the
// command line. Set "made_cmdheight_nonzero" and reset 'scrolloff' to
// avoid scrolling the last window.
made_cmdheight_nonzero = TRUE;
lastwin->w_p_so = 0;
set_option_value((char_u *)"ch", 1L, NULL, 0);
#ifdef HAS_MESSAGE_WINDOW
popup_hide_message_win();
#endif
update_screen(UPD_VALID); // redraw the screen NOW
made_cmdheight_nonzero = FALSE;
lastwin->w_p_so = save_so;
}
// one recursion level deeper // one recursion level deeper
++depth; ++depth;
@ -2577,15 +2558,6 @@ theend:
{ {
char_u *p = ccline.cmdbuff; char_u *p = ccline.cmdbuff;
if (cmdheight0)
{
made_cmdheight_nonzero = TRUE;
set_option_value((char_u *)"ch", 0L, NULL, 0);
// Redraw is needed for command line completion
redraw_all_later(UPD_NOT_VALID);
made_cmdheight_nonzero = FALSE;
}
--depth; --depth;
if (did_save_ccline) if (did_save_ccline)
restore_cmdline(&save_ccline); restore_cmdline(&save_ccline);

View File

@ -2096,10 +2096,6 @@ getchar_common(typval_T *argvars, typval_T *rettv)
--no_mapping; --no_mapping;
--allow_keys; --allow_keys;
// redraw the screen after getchar()
if (p_ch == 0)
update_screen(UPD_NOT_VALID);
set_vim_var_nr(VV_MOUSE_WIN, 0); set_vim_var_nr(VV_MOUSE_WIN, 0);
set_vim_var_nr(VV_MOUSE_WINID, 0); set_vim_var_nr(VV_MOUSE_WINID, 0);
set_vim_var_nr(VV_MOUSE_LNUM, 0); set_vim_var_nr(VV_MOUSE_LNUM, 0);

View File

@ -1734,6 +1734,3 @@ EXTERN int channel_need_redraw INIT(= FALSE);
// While executing a regexp and set to OPTION_MAGIC_ON or OPTION_MAGIC_OFF this // While executing a regexp and set to OPTION_MAGIC_ON or OPTION_MAGIC_OFF this
// overrules p_magic. Otherwise set to OPTION_MAGIC_NOT_SET. // overrules p_magic. Otherwise set to OPTION_MAGIC_NOT_SET.
EXTERN optmagic_T magic_overruled INIT(= OPTION_MAGIC_NOT_SET); EXTERN optmagic_T magic_overruled INIT(= OPTION_MAGIC_NOT_SET);
// Set when 'cmdheight' is changed from zero to one temporarily.
EXTERN int made_cmdheight_nonzero INIT(= FALSE);

View File

@ -1429,7 +1429,6 @@ do_highlight(
// If no argument, list current highlighting. // If no argument, list current highlighting.
if (!init && ends_excmd2(line - 1, line)) if (!init && ends_excmd2(line - 1, line))
{ {
dont_use_message_window();
for (i = 1; i <= highlight_ga.ga_len && !got_int; ++i) for (i = 1; i <= highlight_ga.ga_len && !got_int; ++i)
// TODO: only call when the group has attributes set // TODO: only call when the group has attributes set
highlight_list_one((int)i); highlight_list_one((int)i);

View File

@ -4640,7 +4640,6 @@ attention_message(
stat_T st; stat_T st;
time_t swap_mtime; time_t swap_mtime;
dont_use_message_window();
++no_wait_return; ++no_wait_return;
(void)emsg(_(e_attention)); (void)emsg(_(e_attention));
msg_puts(_("\nFound a swap file by the name \"")); msg_puts(_("\nFound a swap file by the name \""));

View File

@ -208,7 +208,7 @@ msg_strtrunc(
len = vim_strsize(s); len = vim_strsize(s);
if (msg_scrolled != 0 if (msg_scrolled != 0
#ifdef HAS_MESSAGE_WINDOW #ifdef HAS_MESSAGE_WINDOW
|| use_message_window() || in_echowindow
#endif #endif
) )
// Use all the columns. // Use all the columns.
@ -751,7 +751,7 @@ emsg_core(char_u *s)
} }
#ifdef HAS_MESSAGE_WINDOW #ifdef HAS_MESSAGE_WINDOW
if (!use_message_window()) if (!in_echowindow)
#endif #endif
emsg_on_display = TRUE; // remember there is an error message emsg_on_display = TRUE; // remember there is an error message
@ -966,7 +966,7 @@ msg_may_trunc(int force, char_u *s)
// negative. // negative.
room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1; room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1;
if (room > 0 && (force || (shortmess(SHM_TRUNC) && !exmode_active)) if (room > 0 && (force || (shortmess(SHM_TRUNC) && !exmode_active))
&& (n = (int)STRLEN(s) - room) > 0 && p_ch > 0) && (n = (int)STRLEN(s) - room) > 0)
{ {
if (has_mbyte) if (has_mbyte)
{ {
@ -1077,7 +1077,6 @@ ex_messages(exarg_T *eap)
} }
msg_hist_off = TRUE; msg_hist_off = TRUE;
dont_use_message_window();
p = first_msg_hist; p = first_msg_hist;
if (eap->addr_count != 0) if (eap->addr_count != 0)
@ -1429,35 +1428,6 @@ set_keep_msg_from_hist(void)
} }
#endif #endif
/*
* Return TRUE when the message popup window should be used.
*/
int
use_message_window(void)
{
#ifdef HAS_MESSAGE_WINDOW
// TRUE if there is no command line showing ('cmdheight' is zero and not
// already editing or showing a message) use a popup window for messages.
// Also when using ":echowindow".
return (p_ch == 0 && cmdline_row >= Rows) || in_echowindow;
#else
return FALSE;
#endif
}
/*
* Do not use the message window for the next message(s).
* Used when giving a prompt.
*/
void
dont_use_message_window(void)
{
#ifdef HAS_MESSAGE_WINDOW
popup_hide_message_win();
cmdline_row = Rows - 1;
#endif
}
/* /*
* Prepare for outputting characters in the command line. * Prepare for outputting characters in the command line.
*/ */
@ -1473,7 +1443,7 @@ msg_start(void)
} }
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
if (need_clr_eos || use_message_window()) if (need_clr_eos || in_echowindow)
{ {
// Halfway an ":echo" command and getting an (error) message: clear // Halfway an ":echo" command and getting an (error) message: clear
// any text from the command. // any text from the command.
@ -1483,7 +1453,7 @@ msg_start(void)
#endif #endif
#ifdef HAS_MESSAGE_WINDOW #ifdef HAS_MESSAGE_WINDOW
if (use_message_window()) if (in_echowindow)
{ {
if (popup_message_win_visible() if (popup_message_win_visible()
&& ((msg_col > 0 && (msg_scroll || !full_screen)) && ((msg_col > 0 && (msg_scroll || !full_screen))
@ -1510,7 +1480,7 @@ msg_start(void)
#endif #endif
0; 0;
} }
else if (msg_didout || use_message_window()) else if (msg_didout || in_echowindow)
{ {
// start message on next line // start message on next line
msg_putchar('\n'); msg_putchar('\n');
@ -2259,7 +2229,6 @@ msg_puts_attr_len(char *str, int maxlen, int attr)
#define PUT_BELOW 2 // add below "lnum" #define PUT_BELOW 2 // add below "lnum"
// //
#ifdef HAS_MESSAGE_WINDOW #ifdef HAS_MESSAGE_WINDOW
/* /*
* Put text "t_s" until "end" in the message window. * Put text "t_s" until "end" in the message window.
* "where" specifies where to put the text. * "where" specifies where to put the text.
@ -2337,7 +2306,7 @@ msg_puts_display(
win_T *msg_win = NULL; win_T *msg_win = NULL;
linenr_T lnum = 1; linenr_T lnum = 1;
if (use_message_window()) if (in_echowindow)
{ {
msg_win = popup_get_message_win(); msg_win = popup_get_message_win();
@ -2651,7 +2620,7 @@ message_filtered(char_u *msg)
msg_scroll_up(void) msg_scroll_up(void)
{ {
#ifdef HAS_MESSAGE_WINDOW #ifdef HAS_MESSAGE_WINDOW
if (use_message_window()) if (in_echowindow)
return; return;
#endif #endif
#ifdef FEAT_GUI #ifdef FEAT_GUI
@ -3687,7 +3656,7 @@ msg_clr_eos_force(void)
out_str(T_CE); // clear to end of line out_str(T_CE); // clear to end of line
} }
} }
else if (p_ch > 0) else
{ {
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
if (cmdmsg_rl) if (cmdmsg_rl)
@ -3748,7 +3717,7 @@ msg_check(void)
{ {
if (msg_row == Rows - 1 && msg_col >= sc_col if (msg_row == Rows - 1 && msg_col >= sc_col
#ifdef HAS_MESSAGE_WINDOW #ifdef HAS_MESSAGE_WINDOW
&& !use_message_window() && !in_echowindow
#endif #endif
) )
{ {
@ -4090,7 +4059,6 @@ do_dialog(
} }
#endif #endif
dont_use_message_window();
oldState = State; oldState = State;
State = MODE_CONFIRM; State = MODE_CONFIRM;
setmouse(); setmouse();

View File

@ -1796,9 +1796,6 @@ display_showcmd(void)
{ {
int len; int len;
if (p_ch == 0)
return;
cursor_off(); cursor_off();
len = (int)STRLEN(showcmd_buf); len = (int)STRLEN(showcmd_buf);

View File

@ -3260,11 +3260,6 @@ cursor_pos_info(dict_T *dict)
// Don't shorten this message, the user asked for it. // Don't shorten this message, the user asked for it.
p = p_shm; p = p_shm;
p_shm = (char_u *)""; p_shm = (char_u *)"";
if (p_ch < 1)
{
msg_start();
msg_scroll = TRUE;
}
msg((char *)IObuff); msg((char *)IObuff);
p_shm = p; p_shm = p;
} }

View File

@ -3555,7 +3555,7 @@ set_num_option(
// if p_ch changed value, change the command line height // if p_ch changed value, change the command line height
else if (pp == &p_ch) else if (pp == &p_ch)
{ {
if (p_ch < 0) if (p_ch < 1)
{ {
errmsg = e_argument_must_be_positive; errmsg = e_argument_must_be_positive;
p_ch = 1; p_ch = 1;

View File

@ -29,7 +29,7 @@ static poppos_entry_T poppos_entries[] = {
}; };
#ifdef HAS_MESSAGE_WINDOW #ifdef HAS_MESSAGE_WINDOW
// Window used for messages when 'winheight' is zero. // Window used for ":echowindow"
static win_T *message_win = NULL; static win_T *message_win = NULL;
#endif #endif
@ -4529,16 +4529,6 @@ popup_hide_message_win(void)
popup_hide(message_win); popup_hide(message_win);
} }
/*
* If the message window exists: close it.
*/
void
popup_close_message_win(void)
{
if (message_win != NULL)
popup_close(message_win->w_id, TRUE);
}
#endif #endif
/* /*

View File

@ -23,8 +23,6 @@ void msg_end_prompt(void);
void wait_return(int redraw); void wait_return(int redraw);
void set_keep_msg(char_u *s, int attr); void set_keep_msg(char_u *s, int attr);
void set_keep_msg_from_hist(void); void set_keep_msg_from_hist(void);
int use_message_window(void);
void dont_use_message_window(void);
void msg_start(void); void msg_start(void);
void msg_starthere(void); void msg_starthere(void);
void msg_putchar(int c); void msg_putchar(int c);

View File

@ -67,7 +67,6 @@ win_T *popup_get_message_win(void);
void popup_show_message_win(void); void popup_show_message_win(void);
int popup_message_win_visible(void); int popup_message_win_visible(void);
void popup_hide_message_win(void); void popup_hide_message_win(void);
void popup_close_message_win(void);
int popup_win_closed(win_T *win); int popup_win_closed(win_T *win);
void popup_set_title(win_T *wp); void popup_set_title(win_T *wp);
void popup_update_preview_title(void); void popup_update_preview_title(void);

View File

@ -371,7 +371,6 @@ do_record(int c)
{ {
char_u *p; char_u *p;
static int regname; static int regname;
static int changed_cmdheight = FALSE;
yankreg_T *old_y_previous, *old_y_current; yankreg_T *old_y_previous, *old_y_current;
int retval; int retval;
@ -386,15 +385,6 @@ do_record(int c)
showmode(); showmode();
regname = c; regname = c;
retval = OK; retval = OK;
if (p_ch < 1)
{
// Enable macro indicator temporarily
set_option_value((char_u *)"ch", 1L, NULL, 0);
update_screen(UPD_VALID);
changed_cmdheight = TRUE;
}
} }
} }
else // stop recording else // stop recording
@ -422,13 +412,6 @@ do_record(int c)
y_previous = old_y_previous; y_previous = old_y_previous;
y_current = old_y_current; y_current = old_y_current;
} }
if (changed_cmdheight)
{
// Restore cmdheight
set_option_value((char_u *)"ch", 0L, NULL, 0);
redraw_all_later(UPD_CLEAR);
}
} }
return retval; return retval;
} }

View File

@ -4228,7 +4228,7 @@ showmode(void)
int nwr_save; int nwr_save;
int sub_attr; int sub_attr;
do_mode = p_smd && msg_silent == 0 && p_ch > 0 do_mode = p_smd && msg_silent == 0
&& ((State & MODE_INSERT) && ((State & MODE_INSERT)
|| restart_edit != NUL || restart_edit != NUL
|| VIsual_active); || VIsual_active);
@ -4741,7 +4741,7 @@ redrawing(void)
int int
messaging(void) messaging(void)
{ {
return (!(p_lz && char_avail() && !KeyTyped)) && p_ch > 0; return (!(p_lz && char_avail() && !KeyTyped));
} }
/* /*

View File

@ -1,6 +0,0 @@
>s+0&#ffffff0|o|m|e| |t|e|x|t| @65
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73

View File

@ -1,6 +0,0 @@
|s+0&#e0e0e08|o|m|e| >t+0&#ffffff0|e|x|t| @65
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73

View File

@ -1,6 +0,0 @@
|s+0&#ffffff0|o|m|e| >t|e|x|t| @65
|~+0#4040ff13&| @73
|~| @73
|~| @73
|═+0#e000002&@74
|m|e|s@1|a|g|e| |w|i|n|d|o|w| @60

View File

@ -1,6 +0,0 @@
|s+0&#ffffff0|o|m|e| >t|e|x|t| @65
|~+0#4040ff13&| @73
|~| @73
|~| @73
|═+0#e000002&@74
|T|y|p|e| @1|:|q|a|!| @1|a|n|d| |p|r|e|s@1| |<|E|n|t|e|r|>| |t|o| |a|b|a|n|d|o|n| |a|l@1| |c|h|a|n|g|e|s| |a|n|d| |e|x|i|t| |V|i|m| @9

View File

@ -1,6 +0,0 @@
|s+0&#ffffff0|o|m|e| >t|e|x|t| @65
|~+0#4040ff13&| @73
|~| @73
|~| @73
|═+0#e000002&@74
|"|X|s|o|m|e|T|e|x|t|"| |[|N|e|w|]| |1|L|,| |1|0|B| |w|r|i|t@1|e|n| @41

View File

@ -1,6 +0,0 @@
|s+0&#ffffff0|o|m|e| >t|e|x|t| @65
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73

View File

@ -1,6 +0,0 @@
|s+0&#ffffff0|o|m|e| >t|e|x|t| @65
|~+0#4040ff13&| @73
|~| @73
|═+0#e000002&@74
|s|o|m|e| |t|e|x|t| @65
|s|o|m|e| |m|o|r|e| |t|e|x|t| @60

View File

@ -1,6 +0,0 @@
|s+0&#ffffff0|o|m|e| >t|e|x|t| @65
|~+0#4040ff13&| @73
|═+0#e000002&@74
|s|o|m|e| |t|e|x|t| @65
|s|o|m|e| |m|o|r|e| |t|e|x|t| @60
|e|v|e|n| |m|o|r|e| |t|e|x|t| @60

View File

@ -27,7 +27,7 @@ let fontname = has('win32') ? 'fixedsys' : 'fixed'
" Two lists with values: values that work and values that fail. " Two lists with values: values that work and values that fail.
" When not listed, "othernum" or "otherstring" is used. " When not listed, "othernum" or "otherstring" is used.
let test_values = { let test_values = {
\ 'cmdheight': [[0, 1, 2, 10], [-1]], \ 'cmdheight': [[1, 2, 10], [-1, 0]],
\ 'cmdwinheight': [[1, 2, 10], [-1, 0]], \ 'cmdwinheight': [[1, 2, 10], [-1, 0]],
\ 'columns': [[12, 80], [-1, 0, 10]], \ 'columns': [[12, 80], [-1, 0, 10]],
\ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]], \ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]],

View File

@ -387,156 +387,6 @@ func Test_fileinfo_after_echo()
call delete('b.txt') call delete('b.txt')
endfunc endfunc
func Test_cmdheight_zero()
enew
set cmdheight=0
set showcmd
redraw!
let using_popupwin = has('timers') && has('popupwin')
echo 'test echo'
if using_popupwin
redraw
call assert_equal('test echo', Screenline(&lines))
" check that the popup is cleared when entering a command line
call feedkeys(':', 'xt')
redraw
call assert_equal('~', Screenline(&lines))
else
call assert_equal(116, screenchar(&lines, 1))
endif
redraw!
echomsg 'test echomsg'
if using_popupwin
redraw
call assert_equal('test echomsg', Screenline(&lines))
else
call assert_equal(116, screenchar(&lines, 1))
endif
redraw!
if !using_popupwin
call feedkeys(":ls\<CR>", "xt")
call assert_equal(':ls', Screenline(&lines))
redraw!
endif
let char = getchar(0)
call assert_match(char, 0)
" Check change/restore cmdheight when macro
call feedkeys("qa", "xt")
call assert_equal(1, &cmdheight)
call feedkeys("q", "xt")
call assert_equal(0, &cmdheight)
call setline(1, 'somestring')
call feedkeys("y", "n")
%s/somestring/otherstring/gc
call assert_equal('otherstring', getline(1))
call feedkeys("g\<C-g>", "xt")
if using_popupwin
redraw
endif
call assert_match(
\ 'Col 1 of 11; Line 1 of 1; Word 1 of 1',
\ Screenline(&lines))
" Check split behavior
for i in range(1, 10)
split
endfor
only
call assert_equal(0, &cmdheight)
" Check that pressing ":" should not scroll a window
" Check for what patch 9.0.0115 fixes
botright 10new
call setline(1, range(12))
7
call feedkeys(":\"\<C-R>=line('w0')\<CR>\<CR>", "xt")
call assert_equal('"1', @:)
bwipe!
bwipe!
set cmdheight&
set showcmd&
tabnew
tabonly
"redraw to hide the popup window
redraw
endfunc
func Test_cmdheight_zero_dump()
CheckScreendump
let lines =<< trim END
set cmdheight=0
set showmode
call setline(1, 'some text')
func ShowMessages()
echomsg 'some text'
sleep 100m
echomsg 'some more text'
sleep 2500m
echomsg 'even more text'
endfunc
END
call writefile(lines, 'XtestCmdheight')
let buf = RunVimInTerminal('-S XtestCmdheight', #{rows: 6})
" The "-- INSERT --" indicator should not be visible.
call term_sendkeys(buf, "i")
call VerifyScreenDump(buf, 'Test_cmdheight_zero_1', {})
" The "-- VISUAL --" indicator should not be visible.
call term_sendkeys(buf, "\<Esc>vw")
call VerifyScreenDump(buf, 'Test_cmdheight_zero_2', {})
" Echo'd text is in a popup window
call term_sendkeys(buf, "\<Esc>:echo 'message window'\<CR>")
call VerifyScreenDump(buf, 'Test_cmdheight_zero_3', {})
" Message for CTRL-C is in the popup window
call term_sendkeys(buf, "\<C-C>")
call VerifyScreenDump(buf, 'Test_cmdheight_zero_4', {})
" file write message is one line
call term_sendkeys(buf, ":w XsomeText\<CR>")
call VerifyScreenDump(buf, 'Test_cmdheight_zero_5', {})
call term_sendkeys(buf, ":call popup_clear()\<CR>")
call VerifyScreenDump(buf, 'Test_cmdheight_zero_6', {})
call term_sendkeys(buf, ":call ShowMessages()\<CR>")
call VerifyScreenDump(buf, 'Test_cmdheight_zero_7', {})
sleep 2
call VerifyScreenDump(buf, 'Test_cmdheight_zero_8', {})
" clean up
call StopVimInTerminal(buf)
call delete('XtestCmdheight')
call delete('XsomeText')
endfunc
func Test_cmdheight_zero_shell()
CheckUnix
set cmdheight=0
set nomore
call setline(1, 'foo!')
silent !echo <cWORD> > Xfile.out
call assert_equal(['foo!'], readfile('Xfile.out'))
call delete('Xfile.out')
redraw!
set more&
set cmdheight&
endfunc
func Test_echowindow() func Test_echowindow()
CheckScreendump CheckScreendump

View File

@ -1501,12 +1501,9 @@ func Test_win_move_statusline()
call assert_equal(h0, winheight(0)) call assert_equal(h0, winheight(0))
call assert_equal(1, &cmdheight) call assert_equal(1, &cmdheight)
endfor endfor
" supports cmdheight=0
set cmdheight=0
call assert_true(win_move_statusline(0, 1)) call assert_true(win_move_statusline(0, 1))
call assert_equal(h0 + 1, winheight(0)) call assert_equal(h0, winheight(0))
call assert_equal(0, &cmdheight) call assert_equal(1, &cmdheight)
set cmdheight&
" check win_move_statusline from bottom window on top window ID " check win_move_statusline from bottom window on top window ID
let id = win_getid(1) let id = win_getid(1)
for offset in range(5) for offset in range(5)

View File

@ -707,6 +707,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
340,
/**/ /**/
339, 339,
/**/ /**/

View File

@ -992,8 +992,6 @@ win_split_ins(
needed = wmh1 + STATUS_HEIGHT; needed = wmh1 + STATUS_HEIGHT;
if (flags & WSP_ROOM) if (flags & WSP_ROOM)
needed += p_wh - wmh1; needed += p_wh - wmh1;
if (p_ch == 0)
needed += 1; // Adjust for cmdheight=0.
if (flags & (WSP_BOT | WSP_TOP)) if (flags & (WSP_BOT | WSP_TOP))
{ {
minheight = frame_minheight(topframe, NOWIN) + need_status; minheight = frame_minheight(topframe, NOWIN) + need_status;
@ -5693,8 +5691,6 @@ frame_setheight(frame_T *curfrp, int height)
{ {
// topframe: can only change the command line height // topframe: can only change the command line height
if (height > ROWS_AVAIL) if (height > ROWS_AVAIL)
// If height is greater than the available space, try to create
// space for the frame by reducing 'cmdheight' if possible.
height = ROWS_AVAIL; height = ROWS_AVAIL;
if (height > 0) if (height > 0)
frame_new_height(curfrp, height, FALSE, FALSE); frame_new_height(curfrp, height, FALSE, FALSE);
@ -6026,7 +6022,7 @@ win_setminheight(void)
while (p_wmh > 0) while (p_wmh > 0)
{ {
room = Rows - p_ch; room = Rows - p_ch;
needed = min_rows(); needed = min_rows() - 1; // 1 was added for the cmdline
if (room >= needed) if (room >= needed)
break; break;
--p_wmh; --p_wmh;
@ -6076,12 +6072,6 @@ win_drag_status_line(win_T *dragwin, int offset)
int row; int row;
int up; // if TRUE, drag status line up, otherwise down int up; // if TRUE, drag status line up, otherwise down
int n; int n;
static int 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; fr = dragwin->w_frame;
curfr = fr; curfr = fr;
@ -6138,10 +6128,10 @@ win_drag_status_line(win_T *dragwin, int offset)
* Only dragging the last status line can reduce p_ch. * Only dragging the last status line can reduce p_ch.
*/ */
room = Rows - cmdline_row; room = Rows - cmdline_row;
if (curfr->fr_next != NULL) if (curfr->fr_next == NULL)
room -= p_ch;
else if (!p_ch_was_zero)
--room; --room;
else
room -= p_ch;
if (room < 0) if (room < 0)
room = 0; room = 0;
// sum up the room of frames below of the current one // sum up the room of frames below of the current one
@ -6191,8 +6181,9 @@ win_drag_status_line(win_T *dragwin, int offset)
row = win_comp_pos(); row = win_comp_pos();
screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0); screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
cmdline_row = row; cmdline_row = row;
p_ch = MAX(Rows - cmdline_row, p_ch_was_zero ? 0 : 1); p_ch = MAX(Rows - cmdline_row, 1);
curtab->tp_ch_used = p_ch; curtab->tp_ch_used = p_ch;
redraw_all_later(UPD_SOME_VALID); redraw_all_later(UPD_SOME_VALID);
showmode(); showmode();
} }
@ -6355,8 +6346,7 @@ win_new_height(win_T *wp, int height)
// There is no point in adjusting the scroll position when exiting. Some // There is no point in adjusting the scroll position when exiting. Some
// values might be invalid. // values might be invalid.
// Skip scroll_to_fraction() when 'cmdheight' was set to one from zero. if (!exiting)
if (!exiting && !made_cmdheight_nonzero)
scroll_to_fraction(wp, prev_height); scroll_to_fraction(wp, prev_height);
} }
@ -6603,11 +6593,6 @@ command_height(void)
// Recompute window positions. // Recompute window positions.
if (frp != lastwin->w_frame) if (frp != lastwin->w_frame)
(void)win_comp_pos(); (void)win_comp_pos();
#ifdef HAS_MESSAGE_WINDOW
if (p_ch > 0)
popup_close_message_win();
#endif
} }
/* /*
@ -6743,8 +6728,7 @@ min_rows(void)
total = n; total = n;
} }
total += tabline_height(); total += tabline_height();
if (p_ch > 0) total += 1; // count the room for the command line
total += 1; // count the room for the command line
return total; return total;
} }