Skip to content

Commit a2a8973

Browse files
committed
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.
1 parent a63ad78 commit a2a8973

32 files changed

Lines changed: 46 additions & 404 deletions

runtime/doc/options.txt

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,18 +1783,11 @@ A jump table for the options with a short description can be found at |Q_op|.
17831783
*'cmdheight'* *'ch'*
17841784
'cmdheight' 'ch' number (default 1)
17851785
global or local to tab page
1786-
Number of screen lines to use for the command-line. Helps avoiding
1787-
|hit-enter| prompts.
1786+
Number of screen lines to use for the command-line. A larger value
1787+
helps avoiding |hit-enter| prompts.
17881788
The value of this option is stored with the tab page, so that each tab
17891789
page can have a different value.
17901790

1791-
When 'cmdheight' is zero, there is no command-line unless it is being
1792-
used. Informative messages will be displayed in a popup notification
1793-
window at the bottom if the window, using the MessageWindow highlight
1794-
group {only if compiled with the +popupwin and +timers features},
1795-
otherwise they will not be displayed. Other messages will cause the
1796-
|hit-enter| prompt. Expect some other unexpected behavior too.
1797-
17981791
*'cmdwinheight'* *'cwh'*
17991792
'cmdwinheight' 'cwh' number (default 7)
18001793
global
@@ -6474,11 +6467,9 @@ A jump table for the options with a short description can be found at |Q_op|.
64746467
45% relative position in the file
64756468
If 'rulerformat' is set, it will determine the contents of the ruler.
64766469
Each window has its own ruler. If a window has a status line, the
6477-
ruler is shown there. If a window doesn't have a status line and
6478-
'cmdheight' is zero, the ruler is not shown. Otherwise it is shown in
6479-
the last line of the screen. If the statusline is given by
6480-
'statusline' (i.e. not empty), this option takes precedence over
6481-
'ruler' and 'rulerformat'.
6470+
ruler is shown there. Otherwise it is shown in the last line of the
6471+
screen. If the statusline is given by 'statusline' (i.e. not empty),
6472+
this option takes precedence over 'ruler' and 'rulerformat'.
64826473
If the number of characters displayed is different from the number of
64836474
bytes in the text (e.g., for a TAB or a multibyte character), both
64846475
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|.
71287119
|+cmdline_info| feature}
71297120
Show (partial) command in the last line of the screen. Set this
71307121
option off if your terminal is slow.
7131-
The option has no effect when 'cmdheight' is zero.
71327122
In Visual mode the size of the selected area is shown:
71337123
- When selecting characters within a line, the number of characters.
71347124
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|.
71787168
If in Insert, Replace or Visual mode put a message on the last line.
71797169
Use the 'M' flag in 'highlight' to set the type of highlighting for
71807170
this message.
7181-
The option has no effect when 'cmdheight' is zero.
71827171
When |XIM| may be used the message will include "XIM". But this
71837172
doesn't mean XIM is really active, especially when 'imactivatekey' is
71847173
not set.

src/drawscreen.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,8 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
654654
int off = 0;
655655
int width;
656656

657-
// If 'ruler' off or messages area disabled, don't do anything
658-
if (!p_ru || (wp->w_status_height == 0 && p_ch == 0))
657+
// If 'ruler' off don't do anything
658+
if (!p_ru)
659659
return;
660660

661661
/*
@@ -676,7 +676,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
676676
return;
677677

678678
#ifdef FEAT_STL_OPT
679-
if (*p_ruf && p_ch > 0)
679+
if (*p_ruf)
680680
{
681681
int called_emsg_before = called_emsg;
682682

@@ -1814,13 +1814,9 @@ win_update(win_T *wp)
18141814

18151815
// Move the entries that were scrolled, disable
18161816
// the entries for the lines to be redrawn.
1817-
// Avoid using a wrong index when 'cmdheight' is
1818-
// zero and wp->w_height == Rows.
18191817
if ((wp->w_lines_valid += j) > wp->w_height)
18201818
wp->w_lines_valid = wp->w_height;
1821-
for (idx = wp->w_lines_valid >= wp->w_height
1822-
? wp->w_height - 1 : wp->w_lines_valid;
1823-
idx - j >= 0; idx--)
1819+
for (idx = wp->w_lines_valid; idx - j >= 0; idx--)
18241820
wp->w_lines[idx] = wp->w_lines[idx - j];
18251821
while (idx >= 0)
18261822
wp->w_lines[idx--].wl_valid = FALSE;
@@ -2420,8 +2416,7 @@ win_update(win_T *wp)
24202416
if (wp->w_lines_valid > wp->w_height)
24212417
wp->w_lines_valid = wp->w_height;
24222418
for (i = wp->w_lines_valid; i - j >= idx; --i)
2423-
if (i < Rows)
2424-
wp->w_lines[i] = wp->w_lines[i - j];
2419+
wp->w_lines[i] = wp->w_lines[i - j];
24252420

24262421
// The w_lines[] entries for inserted lines are
24272422
// now invalid, but wl_size may be used above.
@@ -2502,8 +2497,7 @@ win_update(win_T *wp)
25022497
// Past end of the window or end of the screen. Note that after
25032498
// resizing wp->w_height may be end up too big. That's a problem
25042499
// elsewhere, but prevent a crash here.
2505-
if (row > wp->w_height
2506-
|| row + wp->w_winrow >= (p_ch > 0 ? Rows : Rows + 1))
2500+
if (row > wp->w_height || row + wp->w_winrow >= Rows)
25072501
{
25082502
// we may need the size of that too long line later on
25092503
if (dollar_vcol == -1)
@@ -2557,7 +2551,7 @@ win_update(win_T *wp)
25572551

25582552
// Safety check: if any of the wl_size values is wrong we might go over
25592553
// the end of w_lines[].
2560-
if (idx >= (p_ch > 0 ? Rows : Rows + 1))
2554+
if (idx >= Rows)
25612555
break;
25622556
}
25632557

@@ -2945,8 +2939,7 @@ redraw_asap(int type)
29452939
redraw_later(type);
29462940
if (msg_scrolled
29472941
|| (State != MODE_NORMAL && State != MODE_NORMAL_BUSY)
2948-
|| exiting
2949-
|| p_ch == 0)
2942+
|| exiting)
29502943
return ret;
29512944

29522945
// Allocate space to save the text displayed in the command line area.

src/eval.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6832,17 +6832,18 @@ ex_execute(exarg_T *eap)
68326832
if (eap->skip)
68336833
--emsg_skip;
68346834
#ifdef HAS_MESSAGE_WINDOW
6835-
if (use_message_window() && eap->cmdidx != CMD_execute)
6835+
if (eap->cmdidx == CMD_echowindow)
68366836
{
68376837
// show the message window now
68386838
ex_redraw(eap);
68396839

68406840
// do not overwrite messages
6841+
// TODO: only for message window
68416842
msg_didout = TRUE;
68426843
if (msg_col == 0)
68436844
msg_col = 1;
6845+
in_echowindow = FALSE;
68446846
}
6845-
in_echowindow = FALSE;
68466847
#endif
68476848
set_nextcmd(eap, arg);
68486849
}

src/ex_cmds.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,6 @@ do_bang(
10111011
if (addr_count == 0) // :!
10121012
{
10131013
// echo the command
1014-
dont_use_message_window();
10151014
msg_start();
10161015
msg_putchar(':');
10171016
msg_putchar('!');
@@ -3702,7 +3701,6 @@ ex_substitute(exarg_T *eap)
37023701
int endcolumn = FALSE; // cursor in last column when done
37033702
pos_T old_cursor = curwin->w_cursor;
37043703
int start_nsubs;
3705-
int cmdheight0 = p_ch == 0;
37063704
#ifdef FEAT_EVAL
37073705
int save_ma = 0;
37083706
int save_sandbox = 0;
@@ -4012,14 +4010,6 @@ ex_substitute(exarg_T *eap)
40124010
}
40134011
}
40144012

4015-
if (cmdheight0)
4016-
{
4017-
// If cmdheight is 0, cmdheight must be set to 1 when we enter command
4018-
// line.
4019-
set_option_value((char_u *)"ch", 1L, NULL, 0);
4020-
redraw_statuslines();
4021-
}
4022-
40234013
/*
40244014
* Check for a match on each line.
40254015
*/
@@ -4902,10 +4892,6 @@ ex_substitute(exarg_T *eap)
49024892
changed_window_setting();
49034893
#endif
49044894

4905-
// Restore cmdheight
4906-
if (cmdheight0)
4907-
set_option_value((char_u *)"ch", 0L, NULL, 0);
4908-
49094895
vim_regfree(regmatch.regprog);
49104896
vim_free(sub_copy);
49114897

src/ex_docmd.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8370,14 +8370,9 @@ ex_redraw(exarg_T *eap)
83708370
// After drawing the statusline screen_attr may still be set.
83718371
screen_stop_highlight();
83728372

8373-
#ifdef HAS_MESSAGE_WINDOW
8374-
if (!use_message_window()) // append messages in the message window
8375-
#endif
8376-
{
8377-
// Reset msg_didout, so that a message that's there is overwritten.
8378-
msg_didout = FALSE;
8379-
msg_col = 0;
8380-
}
8373+
// Reset msg_didout, so that a message that's there is overwritten.
8374+
msg_didout = FALSE;
8375+
msg_col = 0;
83818376

83828377
// No need to wait after an intentional redraw.
83838378
need_wait_return = FALSE;

src/ex_getln.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,25 +1591,6 @@ getcmdline_int(
15911591
int did_save_ccline = FALSE;
15921592
int cmdline_type;
15931593
int wild_type;
1594-
int cmdheight0 = p_ch == 0;
1595-
1596-
if (cmdheight0)
1597-
{
1598-
int save_so = lastwin->w_p_so;
1599-
1600-
// If cmdheight is 0, cmdheight must be set to 1 when we enter the
1601-
// command line. Set "made_cmdheight_nonzero" and reset 'scrolloff' to
1602-
// avoid scrolling the last window.
1603-
made_cmdheight_nonzero = TRUE;
1604-
lastwin->w_p_so = 0;
1605-
set_option_value((char_u *)"ch", 1L, NULL, 0);
1606-
#ifdef HAS_MESSAGE_WINDOW
1607-
popup_hide_message_win();
1608-
#endif
1609-
update_screen(UPD_VALID); // redraw the screen NOW
1610-
made_cmdheight_nonzero = FALSE;
1611-
lastwin->w_p_so = save_so;
1612-
}
16131594

16141595
// one recursion level deeper
16151596
++depth;
@@ -2577,15 +2558,6 @@ getcmdline_int(
25772558
{
25782559
char_u *p = ccline.cmdbuff;
25792560

2580-
if (cmdheight0)
2581-
{
2582-
made_cmdheight_nonzero = TRUE;
2583-
set_option_value((char_u *)"ch", 0L, NULL, 0);
2584-
// Redraw is needed for command line completion
2585-
redraw_all_later(UPD_NOT_VALID);
2586-
made_cmdheight_nonzero = FALSE;
2587-
}
2588-
25892561
--depth;
25902562
if (did_save_ccline)
25912563
restore_cmdline(&save_ccline);

src/getchar.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,10 +2096,6 @@ getchar_common(typval_T *argvars, typval_T *rettv)
20962096
--no_mapping;
20972097
--allow_keys;
20982098

2099-
// redraw the screen after getchar()
2100-
if (p_ch == 0)
2101-
update_screen(UPD_NOT_VALID);
2102-
21032099
set_vim_var_nr(VV_MOUSE_WIN, 0);
21042100
set_vim_var_nr(VV_MOUSE_WINID, 0);
21052101
set_vim_var_nr(VV_MOUSE_LNUM, 0);

src/globals.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,3 @@ EXTERN int channel_need_redraw INIT(= FALSE);
17341734
// While executing a regexp and set to OPTION_MAGIC_ON or OPTION_MAGIC_OFF this
17351735
// overrules p_magic. Otherwise set to OPTION_MAGIC_NOT_SET.
17361736
EXTERN optmagic_T magic_overruled INIT(= OPTION_MAGIC_NOT_SET);
1737-
1738-
// Set when 'cmdheight' is changed from zero to one temporarily.
1739-
EXTERN int made_cmdheight_nonzero INIT(= FALSE);

src/highlight.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,6 @@ do_highlight(
14291429
// If no argument, list current highlighting.
14301430
if (!init && ends_excmd2(line - 1, line))
14311431
{
1432-
dont_use_message_window();
14331432
for (i = 1; i <= highlight_ga.ga_len && !got_int; ++i)
14341433
// TODO: only call when the group has attributes set
14351434
highlight_list_one((int)i);

src/memline.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4640,7 +4640,6 @@ attention_message(
46404640
stat_T st;
46414641
time_t swap_mtime;
46424642

4643-
dont_use_message_window();
46444643
++no_wait_return;
46454644
(void)emsg(_(e_attention));
46464645
msg_puts(_("\nFound a swap file by the name \""));

0 commit comments

Comments
 (0)