summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-31 14:46:18 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-31 14:46:18 +0100
commita2a8973e51a0052bb52e43a2b22e7ecdecc32003 (patch)
tree42700a5eab4930539b87591ad903f7271b527fc3
parenta63ad78ed31e36dbdf3a9cd28071dcdbefce7d19 (diff)
downloadvim-git-a2a8973e51a0052bb52e43a2b22e7ecdecc32003.tar.gz
patch 9.0.0340: the 'cmdheight' zero support causes too much troublev9.0.0340
Problem: The 'cmdheight' zero support causes too much trouble. Solution: Revert support for 'cmdheight' being zero.
-rw-r--r--runtime/doc/options.txt21
-rw-r--r--src/drawscreen.c23
-rw-r--r--src/eval.c5
-rw-r--r--src/ex_cmds.c14
-rw-r--r--src/ex_docmd.c11
-rw-r--r--src/ex_getln.c28
-rw-r--r--src/getchar.c4
-rw-r--r--src/globals.h3
-rw-r--r--src/highlight.c1
-rw-r--r--src/memline.c1
-rw-r--r--src/message.c52
-rw-r--r--src/normal.c3
-rw-r--r--src/ops.c5
-rw-r--r--src/option.c2
-rw-r--r--src/popupwin.c12
-rw-r--r--src/proto/message.pro2
-rw-r--r--src/proto/popupwin.pro1
-rw-r--r--src/register.c17
-rw-r--r--src/screen.c4
-rw-r--r--src/testdir/dumps/Test_cmdheight_zero_1.dump6
-rw-r--r--src/testdir/dumps/Test_cmdheight_zero_2.dump6
-rw-r--r--src/testdir/dumps/Test_cmdheight_zero_3.dump6
-rw-r--r--src/testdir/dumps/Test_cmdheight_zero_4.dump6
-rw-r--r--src/testdir/dumps/Test_cmdheight_zero_5.dump6
-rw-r--r--src/testdir/dumps/Test_cmdheight_zero_6.dump6
-rw-r--r--src/testdir/dumps/Test_cmdheight_zero_7.dump6
-rw-r--r--src/testdir/dumps/Test_cmdheight_zero_8.dump6
-rw-r--r--src/testdir/gen_opt_test.vim2
-rw-r--r--src/testdir/test_messages.vim150
-rw-r--r--src/testdir/test_window_cmd.vim7
-rw-r--r--src/version.c2
-rw-r--r--src/window.c32
32 files changed, 46 insertions, 404 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 1aa5c2cd9..1b9ae38db 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1783,18 +1783,11 @@ A jump table for the options with a short description can be found at |Q_op|.
*'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1)
global or local to tab page
- Number of screen lines to use for the command-line. Helps avoiding
- |hit-enter| prompts.
+ Number of screen lines to use for the command-line. A larger value
+ helps avoiding |hit-enter| prompts.
The value of this option is stored with the tab page, so that each tab
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' number (default 7)
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
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
- ruler is shown there. If a window doesn't have a status line and
- 'cmdheight' is zero, the ruler is not shown. Otherwise it is shown in
- the last line of the screen. If the statusline is given by
- 'statusline' (i.e. not empty), this option takes precedence over
- 'ruler' and 'rulerformat'.
+ ruler is shown there. Otherwise it is shown in the last line of the
+ screen. If the statusline is given by '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
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,
@@ -7128,7 +7119,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|+cmdline_info| feature}
Show (partial) command in the last line of the screen. Set this
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:
- When selecting characters within a line, the number of characters.
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.
Use the 'M' flag in 'highlight' to set the type of highlighting for
this message.
- The option has no effect when 'cmdheight' is zero.
When |XIM| may be used the message will include "XIM". But this
doesn't mean XIM is really active, especially when 'imactivatekey' is
not set.
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 3153d36fd..4e8ef4e87 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -654,8 +654,8 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
int off = 0;
int width;
- // If 'ruler' off or messages area disabled, don't do anything
- if (!p_ru || (wp->w_status_height == 0 && p_ch == 0))
+ // If 'ruler' off don't do anything
+ if (!p_ru)
return;
/*
@@ -676,7 +676,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
return;
#ifdef FEAT_STL_OPT
- if (*p_ruf && p_ch > 0)
+ if (*p_ruf)
{
int called_emsg_before = called_emsg;
@@ -1814,13 +1814,9 @@ win_update(win_T *wp)
// Move the entries that were scrolled, disable
// 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)
wp->w_lines_valid = wp->w_height;
- for (idx = wp->w_lines_valid >= wp->w_height
- ? wp->w_height - 1 : wp->w_lines_valid;
- idx - j >= 0; idx--)
+ for (idx = wp->w_lines_valid; idx - j >= 0; idx--)
wp->w_lines[idx] = wp->w_lines[idx - j];
while (idx >= 0)
wp->w_lines[idx--].wl_valid = FALSE;
@@ -2420,8 +2416,7 @@ win_update(win_T *wp)
if (wp->w_lines_valid > wp->w_height)
wp->w_lines_valid = wp->w_height;
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
// 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
// resizing wp->w_height may be end up too big. That's a problem
// elsewhere, but prevent a crash here.
- if (row > wp->w_height
- || row + wp->w_winrow >= (p_ch > 0 ? Rows : Rows + 1))
+ if (row > wp->w_height || row + wp->w_winrow >= Rows)
{
// we may need the size of that too long line later on
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
// the end of w_lines[].
- if (idx >= (p_ch > 0 ? Rows : Rows + 1))
+ if (idx >= Rows)
break;
}
@@ -2945,8 +2939,7 @@ redraw_asap(int type)
redraw_later(type);
if (msg_scrolled
|| (State != MODE_NORMAL && State != MODE_NORMAL_BUSY)
- || exiting
- || p_ch == 0)
+ || exiting)
return ret;
// Allocate space to save the text displayed in the command line area.
diff --git a/src/eval.c b/src/eval.c
index cc2e1ffcf..2e8d938ec 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -6832,17 +6832,18 @@ ex_execute(exarg_T *eap)
if (eap->skip)
--emsg_skip;
#ifdef HAS_MESSAGE_WINDOW
- if (use_message_window() && eap->cmdidx != CMD_execute)
+ if (eap->cmdidx == CMD_echowindow)
{
// show the message window now
ex_redraw(eap);
// do not overwrite messages
+ // TODO: only for message window
msg_didout = TRUE;
if (msg_col == 0)
msg_col = 1;
+ in_echowindow = FALSE;
}
- in_echowindow = FALSE;
#endif
set_nextcmd(eap, arg);
}
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 1cf090cd8..311b9b7c2 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1011,7 +1011,6 @@ do_bang(
if (addr_count == 0) // :!
{
// echo the command
- dont_use_message_window();
msg_start();
msg_putchar(':');
msg_putchar('!');
@@ -3702,7 +3701,6 @@ ex_substitute(exarg_T *eap)
int endcolumn = FALSE; // cursor in last column when done
pos_T old_cursor = curwin->w_cursor;
int start_nsubs;
- int cmdheight0 = p_ch == 0;
#ifdef FEAT_EVAL
int save_ma = 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.
*/
@@ -4902,10 +4892,6 @@ outofmem:
changed_window_setting();
#endif
- // Restore cmdheight
- if (cmdheight0)
- set_option_value((char_u *)"ch", 0L, NULL, 0);
-
vim_regfree(regmatch.regprog);
vim_free(sub_copy);
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 1891d8085..0d52f58e6 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -8370,14 +8370,9 @@ ex_redraw(exarg_T *eap)
// After drawing the statusline screen_attr may still be set.
screen_stop_highlight();
-#ifdef HAS_MESSAGE_WINDOW
- if (!use_message_window()) // append messages in the message window
-#endif
- {
- // Reset msg_didout, so that a message that's there is overwritten.
- msg_didout = FALSE;
- 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.
need_wait_return = FALSE;
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 25073a869..d425b3eff 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1591,25 +1591,6 @@ getcmdline_int(
int did_save_ccline = FALSE;
int cmdline_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
++depth;
@@ -2577,15 +2558,6 @@ theend:
{
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;
if (did_save_ccline)
restore_cmdline(&save_ccline);
diff --git a/src/getchar.c b/src/getchar.c
index b598997dc..fee9191ba 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2096,10 +2096,6 @@ getchar_common(typval_T *argvars, typval_T *rettv)
--no_mapping;
--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_WINID, 0);
set_vim_var_nr(VV_MOUSE_LNUM, 0);
diff --git a/src/globals.h b/src/globals.h
index f877af3b4..3d75e20d0 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -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
// overrules p_magic. Otherwise set to 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);
diff --git a/src/highlight.c b/src/highlight.c
index 3a12312fc..95cdb46b5 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -1429,7 +1429,6 @@ do_highlight(
// If no argument, list current highlighting.
if (!init && ends_excmd2(line - 1, line))
{
- dont_use_message_window();
for (i = 1; i <= highlight_ga.ga_len && !got_int; ++i)
// TODO: only call when the group has attributes set
highlight_list_one((int)i);
diff --git a/src/memline.c b/src/memline.c
index 6651cda18..42cbad25e 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -4640,7 +4640,6 @@ attention_message(
stat_T st;
time_t swap_mtime;
- dont_use_message_window();
++no_wait_return;
(void)emsg(_(e_attention));
msg_puts(_("\nFound a swap file by the name \""));
diff --git a/src/message.c b/src/message.c
index 0c8280ec0..573f3aedf 100644
--- a/src/message.c
+++ b/src/message.c
@@ -208,7 +208,7 @@ msg_strtrunc(
len = vim_strsize(s);
if (msg_scrolled != 0
#ifdef HAS_MESSAGE_WINDOW
- || use_message_window()
+ || in_echowindow
#endif
)
// Use all the columns.
@@ -751,7 +751,7 @@ emsg_core(char_u *s)
}
#ifdef HAS_MESSAGE_WINDOW
- if (!use_message_window())
+ if (!in_echowindow)
#endif
emsg_on_display = TRUE; // remember there is an error message
@@ -966,7 +966,7 @@ msg_may_trunc(int force, char_u *s)
// negative.
room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1;
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)
{
@@ -1077,7 +1077,6 @@ ex_messages(exarg_T *eap)
}
msg_hist_off = TRUE;
- dont_use_message_window();
p = first_msg_hist;
if (eap->addr_count != 0)
@@ -1430,35 +1429,6 @@ set_keep_msg_from_hist(void)
#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.
*/
void
@@ -1473,7 +1443,7 @@ msg_start(void)
}
#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
// any text from the command.
@@ -1483,7 +1453,7 @@ msg_start(void)
#endif
#ifdef HAS_MESSAGE_WINDOW
- if (use_message_window())
+ if (in_echowindow)
{
if (popup_message_win_visible()
&& ((msg_col > 0 && (msg_scroll || !full_screen))
@@ -1510,7 +1480,7 @@ msg_start(void)
#endif
0;
}
- else if (msg_didout || use_message_window())
+ else if (msg_didout || in_echowindow)
{
// start message on next line
msg_putchar('\n');
@@ -2259,7 +2229,6 @@ msg_puts_attr_len(char *str, int maxlen, int attr)
#define PUT_BELOW 2 // add below "lnum"
//
#ifdef HAS_MESSAGE_WINDOW
-
/*
* Put text "t_s" until "end" in the message window.
* "where" specifies where to put the text.
@@ -2337,7 +2306,7 @@ msg_puts_display(
win_T *msg_win = NULL;
linenr_T lnum = 1;
- if (use_message_window())
+ if (in_echowindow)
{
msg_win = popup_get_message_win();
@@ -2651,7 +2620,7 @@ message_filtered(char_u *msg)
msg_scroll_up(void)
{
#ifdef HAS_MESSAGE_WINDOW
- if (use_message_window())
+ if (in_echowindow)
return;
#endif
#ifdef FEAT_GUI
@@ -3687,7 +3656,7 @@ msg_clr_eos_force(void)
out_str(T_CE); // clear to end of line
}
}
- else if (p_ch > 0)
+ else
{
#ifdef FEAT_RIGHTLEFT
if (cmdmsg_rl)
@@ -3748,7 +3717,7 @@ msg_check(void)
{
if (msg_row == Rows - 1 && msg_col >= sc_col
#ifdef HAS_MESSAGE_WINDOW
- && !use_message_window()
+ && !in_echowindow
#endif
)
{
@@ -4090,7 +4059,6 @@ do_dialog(
}
#endif
- dont_use_message_window();
oldState = State;
State = MODE_CONFIRM;
setmouse();
diff --git a/src/normal.c b/src/normal.c
index 926f50478..fb2bced04 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1796,9 +1796,6 @@ display_showcmd(void)
{
int len;
- if (p_ch == 0)
- return;
-
cursor_off();
len = (int)STRLEN(showcmd_buf);
diff --git a/src/ops.c b/src/ops.c
index 0f7837eba..473397652 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -3260,11 +3260,6 @@ cursor_pos_info(dict_T *dict)
// Don't shorten this message, the user asked for it.
p = p_shm;
p_shm = (char_u *)"";
- if (p_ch < 1)
- {
- msg_start();
- msg_scroll = TRUE;
- }
msg((char *)IObuff);
p_shm = p;
}
diff --git a/src/option.c b/src/option.c
index 957335114..5ce52184e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3555,7 +3555,7 @@ set_num_option(
// if p_ch changed value, change the command line height
else if (pp == &p_ch)
{
- if (p_ch < 0)
+ if (p_ch < 1)
{
errmsg = e_argument_must_be_positive;
p_ch = 1;
diff --git a/src/popupwin.c b/src/popupwin.c
index 2f9df8d9e..8292dba32 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -29,7 +29,7 @@ static poppos_entry_T poppos_entries[] = {
};
#ifdef HAS_MESSAGE_WINDOW
-// Window used for messages when 'winheight' is zero.
+// Window used for ":echowindow"
static win_T *message_win = NULL;
#endif
@@ -4529,16 +4529,6 @@ popup_hide_message_win(void)
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
/*
diff --git a/src/proto/message.pro b/src/proto/message.pro
index f0bd4f336..3f8a8fe2e 100644
--- a/src/proto/message.pro
+++ b/src/proto/message.pro
@@ -23,8 +23,6 @@ void msg_end_prompt(void);
void wait_return(int redraw);
void set_keep_msg(char_u *s, int attr);
void set_keep_msg_from_hist(void);
-int use_message_window(void);
-void dont_use_message_window(void);
void msg_start(void);
void msg_starthere(void);
void msg_putchar(int c);
diff --git a/src/proto/popupwin.pro b/src/proto/popupwin.pro
index 4d669ef86..dcc14de09 100644
--- a/src/proto/popupwin.pro
+++ b/src/proto/popupwin.pro
@@ -67,7 +67,6 @@ win_T *popup_get_message_win(void);
void popup_show_message_win(void);
int popup_message_win_visible(void);
void popup_hide_message_win(void);
-void popup_close_message_win(void);
int popup_win_closed(win_T *win);
void popup_set_title(win_T *wp);
void popup_update_preview_title(void);
diff --git a/src/register.c b/src/register.c
index 6a9cb1e02..ac1d6a3a5 100644
--- a/src/register.c
+++ b/src/register.c
@@ -371,7 +371,6 @@ do_record(int c)
{
char_u *p;
static int regname;
- static int changed_cmdheight = FALSE;
yankreg_T *old_y_previous, *old_y_current;
int retval;
@@ -386,15 +385,6 @@ do_record(int c)
showmode();
regname = c;
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
@@ -422,13 +412,6 @@ do_record(int c)
y_previous = old_y_previous;
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;
}
diff --git a/src/screen.c b/src/screen.c
index eb01fdbd3..12377d56b 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4228,7 +4228,7 @@ showmode(void)
int nwr_save;
int sub_attr;
- do_mode = p_smd && msg_silent == 0 && p_ch > 0
+ do_mode = p_smd && msg_silent == 0
&& ((State & MODE_INSERT)
|| restart_edit != NUL
|| VIsual_active);
@@ -4741,7 +4741,7 @@ redrawing(void)
int
messaging(void)
{
- return (!(p_lz && char_avail() && !KeyTyped)) && p_ch > 0;
+ return (!(p_lz && char_avail() && !KeyTyped));
}
/*
diff --git a/src/testdir/dumps/Test_cmdheight_zero_1.dump b/src/testdir/dumps/Test_cmdheight_zero_1.dump
deleted file mode 100644
index 6fd15a07d..000000000
--- a/src/testdir/dumps/Test_cmdheight_zero_1.dump
+++ /dev/null
@@ -1,6 +0,0 @@
->s+0&#ffffff0|o|m|e| |t|e|x|t| @65
-|~+0#4040ff13&| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
diff --git a/src/testdir/dumps/Test_cmdheight_zero_2.dump b/src/testdir/dumps/Test_cmdheight_zero_2.dump
deleted file mode 100644
index d8c3aeafe..000000000
--- a/src/testdir/dumps/Test_cmdheight_zero_2.dump
+++ /dev/null
@@ -1,6 +0,0 @@
-|s+0&#e0e0e08|o|m|e| >t+0&#ffffff0|e|x|t| @65
-|~+0#4040ff13&| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
diff --git a/src/testdir/dumps/Test_cmdheight_zero_3.dump b/src/testdir/dumps/Test_cmdheight_zero_3.dump
deleted file mode 100644
index ea83d3dcc..000000000
--- a/src/testdir/dumps/Test_cmdheight_zero_3.dump
+++ /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_cmdheight_zero_4.dump b/src/testdir/dumps/Test_cmdheight_zero_4.dump
deleted file mode 100644
index a91d971b0..000000000
--- a/src/testdir/dumps/Test_cmdheight_zero_4.dump
+++ /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_cmdheight_zero_5.dump b/src/testdir/dumps/Test_cmdheight_zero_5.dump
deleted file mode 100644
index dd64210fc..000000000
--- a/src/testdir/dumps/Test_cmdheight_zero_5.dump
+++ /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_cmdheight_zero_6.dump b/src/testdir/dumps/Test_cmdheight_zero_6.dump
deleted file mode 100644
index 7af84c921..000000000
--- a/src/testdir/dumps/Test_cmdheight_zero_6.dump
+++ /dev/null
@@ -1,6 +0,0 @@
-|s+0&#ffffff0|o|m|e| >t|e|x|t| @65
-|~+0#4040ff13&| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
diff --git a/src/testdir/dumps/Test_cmdheight_zero_7.dump b/src/testdir/dumps/Test_cmdheight_zero_7.dump
deleted file mode 100644
index 3c57623a6..000000000
--- a/src/testdir/dumps/Test_cmdheight_zero_7.dump
+++ /dev/null
@@ -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
diff --git a/src/testdir/dumps/Test_cmdheight_zero_8.dump b/src/testdir/dumps/Test_cmdheight_zero_8.dump
deleted file mode 100644
index 6dbd42c5d..000000000
--- a/src/testdir/dumps/Test_cmdheight_zero_8.dump
+++ /dev/null
@@ -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
diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim
index a55216083..83f43f7b5 100644
--- a/src/testdir/gen_opt_test.vim
+++ b/src/testdir/gen_opt_test.vim
@@ -27,7 +27,7 @@ let fontname = has('win32') ? 'fixedsys' : 'fixed'
" Two lists with values: values that work and values that fail.
" When not listed, "othernum" or "otherstring" is used.
let test_values = {
- \ 'cmdheight': [[0, 1, 2, 10], [-1]],
+ \ 'cmdheight': [[1, 2, 10], [-1, 0]],
\ 'cmdwinheight': [[1, 2, 10], [-1, 0]],
\ 'columns': [[12, 80], [-1, 0, 10]],
\ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]],
diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim
index 2c8974885..6bdaedfd6 100644
--- a/src/testdir/test_messages.vim
+++ b/src/testdir/test_messages.vim
@@ -387,156 +387,6 @@ func Test_fileinfo_after_echo()
call delete('b.txt')
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()
CheckScreendump
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index 0fe0f11c4..04a5d1058 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -1501,12 +1501,9 @@ func Test_win_move_statusline()
call assert_equal(h0, winheight(0))
call assert_equal(1, &cmdheight)
endfor
- " supports cmdheight=0
- set cmdheight=0
call assert_true(win_move_statusline(0, 1))
- call assert_equal(h0 + 1, winheight(0))
- call assert_equal(0, &cmdheight)
- set cmdheight&
+ call assert_equal(h0, winheight(0))
+ call assert_equal(1, &cmdheight)
" check win_move_statusline from bottom window on top window ID
let id = win_getid(1)
for offset in range(5)
diff --git a/src/version.c b/src/version.c
index 354a2e433..d88688277 100644
--- a/src/version.c
+++ b/src/version.c
@@ -708,6 +708,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 340,
+/**/
339,
/**/
338,
diff --git a/src/window.c b/src/window.c
index 7ea7b5b2a..65dec1008 100644
--- a/src/window.c
+++ b/src/window.c
@@ -992,8 +992,6 @@ win_split_ins(
needed = wmh1 + STATUS_HEIGHT;
if (flags & WSP_ROOM)
needed += p_wh - wmh1;
- if (p_ch == 0)
- needed += 1; // Adjust for cmdheight=0.
if (flags & (WSP_BOT | WSP_TOP))
{
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
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;
if (height > 0)
frame_new_height(curfrp, height, FALSE, FALSE);
@@ -6026,7 +6022,7 @@ win_setminheight(void)
while (p_wmh > 0)
{
room = Rows - p_ch;
- needed = min_rows();
+ needed = min_rows() - 1; // 1 was added for the cmdline
if (room >= needed)
break;
--p_wmh;
@@ -6076,12 +6072,6 @@ win_drag_status_line(win_T *dragwin, int offset)
int row;
int up; // if TRUE, drag status line up, otherwise down
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;
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.
*/
room = Rows - cmdline_row;
- if (curfr->fr_next != NULL)
- room -= p_ch;
- else if (!p_ch_was_zero)
+ if (curfr->fr_next == NULL)
--room;
+ else
+ room -= p_ch;
if (room < 0)
room = 0;
// 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();
screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
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;
+
redraw_all_later(UPD_SOME_VALID);
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
// values might be invalid.
- // Skip scroll_to_fraction() when 'cmdheight' was set to one from zero.
- if (!exiting && !made_cmdheight_nonzero)
+ if (!exiting)
scroll_to_fraction(wp, prev_height);
}
@@ -6603,11 +6593,6 @@ command_height(void)
// Recompute window positions.
if (frp != lastwin->w_frame)
(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 += 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;
}