diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-31 14:46:18 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-31 14:46:18 +0100 |
commit | a2a8973e51a0052bb52e43a2b22e7ecdecc32003 (patch) | |
tree | 42700a5eab4930539b87591ad903f7271b527fc3 /src | |
parent | a63ad78ed31e36dbdf3a9cd28071dcdbefce7d19 (diff) |
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.
Diffstat (limited to 'src')
31 files changed, 41 insertions, 388 deletions
diff --git a/src/drawscreen.c b/src/drawscreen.c index 3153d36fd1..4e8ef4e876 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 cc2e1ffcf5..2e8d938ec6 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 1cf090cd81..311b9b7c2f 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 1891d8085a..0d52f58e62 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 25073a869f..d425b3effb 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 b598997dc8..fee9191ba0 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 f877af3b4e..3d75e20d01 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 3a12312fc5..95cdb46b5a 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 6651cda18c..42cbad25e3 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 0c8280ec05..573f3aedf1 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 926f50478e..fb2bced04a 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); @@ -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 9573351145..5ce52184ea 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 2f9df8d9e8..8292dba32e 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 f0bd4f3364..3f8a8fe2e3 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 4d669ef868..dcc14de091 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 6a9cb1e02f..ac1d6a3a52 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 eb01fdbd33..12377d56bf 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 6fd15a07db..0000000000 --- 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 d8c3aeafec..0000000000 --- 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 ea83d3dccf..0000000000 --- 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 a91d971b0a..0000000000 --- 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 dd64210fc2..0000000000 --- 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 7af84c9216..0000000000 --- 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 3c57623a65..0000000000 --- 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 6dbd42c5d1..0000000000 --- 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 a55216083c..83f43f7b57 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 2c89748855..6bdaedfd69 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 0fe0f11c41..04a5d1058d 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 35 |