Patch 9.0.0340

13 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 31, 2022, 9:47:09 AM8/31/22
to vim...@googlegroups.com

Patch 9.0.0340
Problem: The 'cmdheight' zero support causes too much trouble.
Solution: Revert support for 'cmdheight' being zero.
Files: runtime/doc/options.txt, src/globals.h, src/drawscreen.c,
src/message.c, src/proto/message.pro, src/eval.c, src/ex_cmds.c,
src/ex_docmd.c, src/ex_getln.c, src/normal.c, src/getchar.c,
src/highlight.c, src/memline.c, src/popupwin.c,
src/proto/popupwin.pro, src/ops.c, src/option.c, src/register.c,
src/screen.c, src/window.c, src/testdir/gen_opt_test.vim,
src/testdir/test_messages.vim, src/testdir/test_window_cmd.vim,
src/testdir/dumps/Test_cmdheight_zero_1.dump,
src/testdir/dumps/Test_cmdheight_zero_2.dump,
src/testdir/dumps/Test_cmdheight_zero_3.dump,
src/testdir/dumps/Test_cmdheight_zero_4.dump,
src/testdir/dumps/Test_cmdheight_zero_5.dump,
src/testdir/dumps/Test_cmdheight_zero_6.dump,
src/testdir/dumps/Test_cmdheight_zero_7.dump,
src/testdir/dumps/Test_cmdheight_zero_8.dump


*** ../vim-9.0.0339/runtime/doc/options.txt 2022-08-27 21:29:28.253402881 +0100
--- runtime/doc/options.txt 2022-08-31 13:37:50.659894149 +0100
***************
*** 1757,1774 ****
*'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.
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
--- 1783,1793 ----
*'cmdheight'* *'ch'*
'cmdheight' 'ch' number (default 1)
global or local to tab page
! 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.

*'cmdwinheight'* *'cwh'*
'cmdwinheight' 'cwh' number (default 7)
global
***************
*** 6448,6458 ****
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'.
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,
--- 6467,6475 ----
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. 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,
***************
*** 7102,7108 ****
|+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"
--- 7119,7124 ----
***************
*** 7152,7158 ****
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.
--- 7168,7173 ----
*** ../vim-9.0.0339/src/globals.h 2022-08-29 18:16:11.578636822 +0100
--- src/globals.h 2022-08-31 12:31:03.810132789 +0100
***************
*** 1734,1739 ****
// 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);
--- 1734,1736 ----
*** ../vim-9.0.0339/src/drawscreen.c 2022-08-30 22:24:20.048441013 +0100
--- src/drawscreen.c 2022-08-31 13:14:11.232138435 +0100
***************
*** 654,661 ****
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))
return;

/*
--- 654,661 ----
int off = 0;
int width;

! // If 'ruler' off don't do anything
! if (!p_ru)
return;

/*
***************
*** 676,682 ****
return;

#ifdef FEAT_STL_OPT
! if (*p_ruf && p_ch > 0)
{
int called_emsg_before = called_emsg;

--- 676,682 ----
return;

#ifdef FEAT_STL_OPT
! if (*p_ruf)
{
int called_emsg_before = called_emsg;

***************
*** 1814,1826 ****

// 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--)
wp->w_lines[idx] = wp->w_lines[idx - j];
while (idx >= 0)
wp->w_lines[idx--].wl_valid = FALSE;
--- 1814,1822 ----

// Move the entries that were scrolled, disable
// the entries for the lines to be redrawn.
if ((wp->w_lines_valid += j) > wp->w_height)
wp->w_lines_valid = wp->w_height;
! 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,2427 ****
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];

// The w_lines[] entries for inserted lines are
// now invalid, but wl_size may be used above.
--- 2416,2422 ----
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)
! 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,2509 ****
// 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))
{
// we may need the size of that too long line later on
if (dollar_vcol == -1)
--- 2497,2503 ----
// 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 >= Rows)
{
// we may need the size of that too long line later on
if (dollar_vcol == -1)
***************
*** 2557,2563 ****

// 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))
break;
}

--- 2551,2557 ----

// Safety check: if any of the wl_size values is wrong we might go over
// the end of w_lines[].
! if (idx >= Rows)
break;
}

***************
*** 2945,2952 ****
redraw_later(type);
if (msg_scrolled
|| (State != MODE_NORMAL && State != MODE_NORMAL_BUSY)
! || exiting
! || p_ch == 0)
return ret;

// Allocate space to save the text displayed in the command line area.
--- 2939,2945 ----
redraw_later(type);
if (msg_scrolled
|| (State != MODE_NORMAL && State != MODE_NORMAL_BUSY)
! || exiting)
return ret;

// Allocate space to save the text displayed in the command line area.
*** ../vim-9.0.0339/src/message.c 2022-08-30 15:44:18.848029743 +0100
--- src/message.c 2022-08-31 12:47:26.474222874 +0100
***************
*** 208,214 ****
len = vim_strsize(s);
if (msg_scrolled != 0
#ifdef HAS_MESSAGE_WINDOW
! || use_message_window()
#endif
)
// Use all the columns.
--- 208,214 ----
len = vim_strsize(s);
if (msg_scrolled != 0
#ifdef HAS_MESSAGE_WINDOW
! || in_echowindow
#endif
)
// Use all the columns.
***************
*** 751,757 ****
}

#ifdef HAS_MESSAGE_WINDOW
! if (!use_message_window())
#endif
emsg_on_display = TRUE; // remember there is an error message

--- 751,757 ----
}

#ifdef HAS_MESSAGE_WINDOW
! if (!in_echowindow)
#endif
emsg_on_display = TRUE; // remember there is an error message

***************
*** 966,972 ****
// 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)
{
if (has_mbyte)
{
--- 966,972 ----
// 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)
{
if (has_mbyte)
{
***************
*** 1077,1083 ****
}

msg_hist_off = TRUE;
- dont_use_message_window();

p = first_msg_hist;
if (eap->addr_count != 0)
--- 1077,1082 ----
***************
*** 1430,1464 ****
#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
--- 1429,1434 ----
***************
*** 1473,1479 ****
}

#ifdef FEAT_EVAL
! if (need_clr_eos || use_message_window())
{
// Halfway an ":echo" command and getting an (error) message: clear
// any text from the command.
--- 1443,1449 ----
}

#ifdef FEAT_EVAL
! if (need_clr_eos || in_echowindow)
{
// Halfway an ":echo" command and getting an (error) message: clear
// any text from the command.
***************
*** 1483,1489 ****
#endif

#ifdef HAS_MESSAGE_WINDOW
! if (use_message_window())
{
if (popup_message_win_visible()
&& ((msg_col > 0 && (msg_scroll || !full_screen))
--- 1453,1459 ----
#endif

#ifdef HAS_MESSAGE_WINDOW
! if (in_echowindow)
{
if (popup_message_win_visible()
&& ((msg_col > 0 && (msg_scroll || !full_screen))
***************
*** 1510,1516 ****
#endif
0;
}
! else if (msg_didout || use_message_window())
{
// start message on next line
msg_putchar('\n');
--- 1480,1486 ----
#endif
0;
}
! else if (msg_didout || in_echowindow)
{
// start message on next line
msg_putchar('\n');
***************
*** 2259,2265 ****
#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.
--- 2229,2234 ----
***************
*** 2337,2343 ****
win_T *msg_win = NULL;
linenr_T lnum = 1;

! if (use_message_window())
{
msg_win = popup_get_message_win();

--- 2306,2312 ----
win_T *msg_win = NULL;
linenr_T lnum = 1;

! if (in_echowindow)
{
msg_win = popup_get_message_win();

***************
*** 2651,2657 ****
msg_scroll_up(void)
{
#ifdef HAS_MESSAGE_WINDOW
! if (use_message_window())
return;
#endif
#ifdef FEAT_GUI
--- 2620,2626 ----
msg_scroll_up(void)
{
#ifdef HAS_MESSAGE_WINDOW
! if (in_echowindow)
return;
#endif
#ifdef FEAT_GUI
***************
*** 3687,3693 ****
out_str(T_CE); // clear to end of line
}
}
! else if (p_ch > 0)
{
#ifdef FEAT_RIGHTLEFT
if (cmdmsg_rl)
--- 3656,3662 ----
out_str(T_CE); // clear to end of line
}
}
! else
{
#ifdef FEAT_RIGHTLEFT
if (cmdmsg_rl)
***************
*** 3748,3754 ****
{
if (msg_row == Rows - 1 && msg_col >= sc_col
#ifdef HAS_MESSAGE_WINDOW
! && !use_message_window()
#endif
)
{
--- 3717,3723 ----
{
if (msg_row == Rows - 1 && msg_col >= sc_col
#ifdef HAS_MESSAGE_WINDOW
! && !in_echowindow
#endif
)
{
***************
*** 4090,4096 ****
}
#endif

- dont_use_message_window();
oldState = State;
State = MODE_CONFIRM;
setmouse();
--- 4059,4064 ----
*** ../vim-9.0.0339/src/proto/message.pro 2022-08-28 22:17:46.294785790 +0100
--- src/proto/message.pro 2022-08-31 12:47:33.014206065 +0100
***************
*** 23,30 ****
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);
--- 23,28 ----
*** ../vim-9.0.0339/src/eval.c 2022-08-29 18:16:11.578636822 +0100
--- src/eval.c 2022-08-31 12:44:40.294671134 +0100
***************
*** 6832,6848 ****
if (eap->skip)
--emsg_skip;
#ifdef HAS_MESSAGE_WINDOW
! if (use_message_window() && eap->cmdidx != CMD_execute)
{
// show the message window now
ex_redraw(eap);

// do not overwrite messages
msg_didout = TRUE;
if (msg_col == 0)
msg_col = 1;
}
- in_echowindow = FALSE;
#endif
set_nextcmd(eap, arg);
}
--- 6832,6849 ----
if (eap->skip)
--emsg_skip;
#ifdef HAS_MESSAGE_WINDOW
! 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;
}
#endif
set_nextcmd(eap, arg);
}
*** ../vim-9.0.0339/src/ex_cmds.c 2022-08-30 18:17:11.546152303 +0100
--- src/ex_cmds.c 2022-08-31 13:07:23.338254980 +0100
***************
*** 1011,1017 ****
if (addr_count == 0) // :!
{
// echo the command
- dont_use_message_window();
msg_start();
msg_putchar(':');
msg_putchar('!');
--- 1011,1016 ----
***************
*** 3702,3708 ****
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;
--- 3701,3706 ----
***************
*** 4012,4025 ****
}
}

- 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.
*/
--- 4010,4015 ----
***************
*** 4902,4911 ****
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);

--- 4892,4897 ----
*** ../vim-9.0.0339/src/ex_docmd.c 2022-08-29 15:06:46.720715534 +0100
--- src/ex_docmd.c 2022-08-31 12:38:26.171902455 +0100
***************
*** 8370,8383 ****
// 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;
! }

// No need to wait after an intentional redraw.
need_wait_return = FALSE;
--- 8370,8378 ----
// After drawing the statusline screen_attr may still be set.
screen_stop_highlight();

! // 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;
*** ../vim-9.0.0339/src/ex_getln.c 2022-08-29 18:16:11.578636822 +0100
--- src/ex_getln.c 2022-08-31 12:31:34.477934523 +0100
***************
*** 1591,1615 ****
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;
--- 1591,1596 ----
***************
*** 2577,2591 ****
{
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);
--- 2558,2563 ----
*** ../vim-9.0.0339/src/normal.c 2022-08-29 00:08:35.418233993 +0100
--- src/normal.c 2022-08-31 13:07:34.638328659 +0100
***************
*** 1796,1804 ****
{
int len;

- if (p_ch == 0)
- return;
-
cursor_off();

len = (int)STRLEN(showcmd_buf);
--- 1796,1801 ----
*** ../vim-9.0.0339/src/getchar.c 2022-08-29 15:06:46.716715543 +0100
--- src/getchar.c 2022-08-31 12:26:45.284207988 +0100
***************
*** 2096,2105 ****
--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);
--- 2096,2101 ----
*** ../vim-9.0.0339/src/highlight.c 2022-08-30 15:44:18.848029743 +0100
--- src/highlight.c 2022-08-31 12:11:25.137455930 +0100
***************
*** 1429,1435 ****
// 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);
--- 1429,1434 ----
*** ../vim-9.0.0339/src/memline.c 2022-08-29 15:06:46.720715534 +0100
--- src/memline.c 2022-08-31 12:11:34.765455930 +0100
***************
*** 4640,4646 ****
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 \""));
--- 4640,4645 ----
*** ../vim-9.0.0339/src/popupwin.c 2022-08-30 19:48:17.202760217 +0100
--- src/popupwin.c 2022-08-31 12:57:41.684818573 +0100
***************
*** 29,35 ****
};

#ifdef HAS_MESSAGE_WINDOW
! // Window used for messages when 'winheight' is zero.
static win_T *message_win = NULL;
#endif

--- 29,35 ----
};

#ifdef HAS_MESSAGE_WINDOW
! // Window used for ":echowindow"
static win_T *message_win = NULL;
#endif

***************
*** 4529,4544 ****
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

/*
--- 4529,4534 ----
*** ../vim-9.0.0339/src/proto/popupwin.pro 2022-08-29 13:44:24.166897355 +0100
--- src/proto/popupwin.pro 2022-08-31 12:57:57.064786517 +0100
***************
*** 67,73 ****
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);
--- 67,72 ----
*** ../vim-9.0.0339/src/ops.c 2022-08-14 14:16:07.995582211 +0100
--- src/ops.c 2022-08-31 13:41:55.014894340 +0100
***************
*** 3260,3270 ****
// 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;
}
--- 3260,3265 ----
*** ../vim-9.0.0339/src/option.c 2022-08-29 15:06:46.720715534 +0100
--- src/option.c 2022-08-31 13:42:41.346744880 +0100
***************
*** 3555,3561 ****
// if p_ch changed value, change the command line height
else if (pp == &p_ch)
{
! if (p_ch < 0)
{
errmsg = e_argument_must_be_positive;
p_ch = 1;
--- 3555,3561 ----
// if p_ch changed value, change the command line height
else if (pp == &p_ch)
{
! if (p_ch < 1)
{
errmsg = e_argument_must_be_positive;
p_ch = 1;
*** ../vim-9.0.0339/src/register.c 2022-08-25 16:02:09.681816465 +0100
--- src/register.c 2022-08-31 13:43:29.410600593 +0100
***************
*** 371,377 ****
{
char_u *p;
static int regname;
- static int changed_cmdheight = FALSE;
yankreg_T *old_y_previous, *old_y_current;
int retval;

--- 371,376 ----
***************
*** 386,400 ****
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
--- 385,390 ----
***************
*** 422,434 ****
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;
}
--- 412,417 ----
*** ../vim-9.0.0339/src/screen.c 2022-08-29 13:44:24.166897355 +0100
--- src/screen.c 2022-08-31 13:05:34.061455313 +0100
***************
*** 4228,4234 ****
int nwr_save;
int sub_attr;

! do_mode = p_smd && msg_silent == 0 && p_ch > 0
&& ((State & MODE_INSERT)
|| restart_edit != NUL
|| VIsual_active);
--- 4228,4234 ----
int nwr_save;
int sub_attr;

! do_mode = p_smd && msg_silent == 0
&& ((State & MODE_INSERT)
|| restart_edit != NUL
|| VIsual_active);
***************
*** 4741,4747 ****
int
messaging(void)
{
! return (!(p_lz && char_avail() && !KeyTyped)) && p_ch > 0;
}

/*
--- 4741,4747 ----
int
messaging(void)
{
! return (!(p_lz && char_avail() && !KeyTyped));
}

/*
*** ../vim-9.0.0339/src/window.c 2022-08-30 11:53:42.748243478 +0100
--- src/window.c 2022-08-31 13:51:58.433539110 +0100
***************
*** 992,999 ****
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;
--- 992,997 ----
***************
*** 5693,5700 ****
{
// 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);
--- 5691,5696 ----
***************
*** 6026,6032 ****
while (p_wmh > 0)
{
room = Rows - p_ch;
! needed = min_rows();
if (room >= needed)
break;
--p_wmh;
--- 6022,6028 ----
while (p_wmh > 0)
{
room = Rows - p_ch;
! needed = min_rows() - 1; // 1 was added for the cmdline
if (room >= needed)
break;
--p_wmh;
***************
*** 6076,6087 ****
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;
--- 6072,6077 ----
***************
*** 6138,6147 ****
* 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)
--room;
if (room < 0)
room = 0;
// sum up the room of frames below of the current one
--- 6128,6137 ----
* Only dragging the last status line can reduce p_ch.
*/
room = Rows - cmdline_row;
! 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,6198 ****
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);
curtab->tp_ch_used = p_ch;
redraw_all_later(UPD_SOME_VALID);
showmode();
}
--- 6181,6189 ----
row = win_comp_pos();
screen_fill(row, cmdline_row, 0, (int)Columns, ' ', ' ', 0);
cmdline_row = row;
! p_ch = MAX(Rows - cmdline_row, 1);
curtab->tp_ch_used = p_ch;
+
redraw_all_later(UPD_SOME_VALID);
showmode();
}
***************
*** 6355,6362 ****

// 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)
scroll_to_fraction(wp, prev_height);
}

--- 6346,6352 ----

// There is no point in adjusting the scroll position when exiting. Some
// values might be invalid.
! if (!exiting)
scroll_to_fraction(wp, prev_height);
}

***************
*** 6603,6613 ****
// 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
}

/*
--- 6593,6598 ----
***************
*** 6743,6750 ****
total = n;
}
total += tabline_height();
! if (p_ch > 0)
! total += 1; // count the room for the command line
return total;
}

--- 6728,6734 ----
total = n;
}
total += tabline_height();
! total += 1; // count the room for the command line
return total;
}

*** ../vim-9.0.0339/src/testdir/gen_opt_test.vim 2022-07-30 16:54:01.867698285 +0100
--- src/testdir/gen_opt_test.vim 2022-08-31 14:41:51.393870359 +0100
***************
*** 27,33 ****
" 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]],
\ 'cmdwinheight': [[1, 2, 10], [-1, 0]],
\ 'columns': [[12, 80], [-1, 0, 10]],
\ 'conceallevel': [[0, 1, 2, 3], [-1, 4, 99]],
--- 27,33 ----
" Two lists with values: values that work and values that fail.
" When not listed, "othernum" or "otherstring" is used.
let test_values = {
! \ '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]],
*** ../vim-9.0.0339/src/testdir/test_messages.vim 2022-08-29 18:16:11.578636822 +0100
--- src/testdir/test_messages.vim 2022-08-31 12:41:19.875282853 +0100
***************
*** 387,542 ****
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

--- 387,392 ----
*** ../vim-9.0.0339/src/testdir/test_window_cmd.vim 2022-08-30 19:48:17.210760193 +0100
--- src/testdir/test_window_cmd.vim 2022-08-31 13:53:53.097376432 +0100
***************
*** 1501,1512 ****
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&
" check win_move_statusline from bottom window on top window ID
let id = win_getid(1)
for offset in range(5)
--- 1501,1509 ----
call assert_equal(h0, winheight(0))
call assert_equal(1, &cmdheight)
endfor
call assert_true(win_move_statusline(0, 1))
! 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)
*** ../vim-9.0.0339/src/testdir/dumps/Test_cmdheight_zero_1.dump 2022-08-28 13:02:23.955786926 +0100
--- src/testdir/dumps/Test_cmdheight_zero_1.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,6 ****
- >s+0&#ffffff0|o|m|e| |t|e|x|t| @65
- |~+0#4040ff13&| @73
- |~| @73
- |~| @73
- |~| @73
- |~| @73
--- 0 ----
*** ../vim-9.0.0339/src/testdir/dumps/Test_cmdheight_zero_2.dump 2022-08-28 13:02:23.955786926 +0100
--- src/testdir/dumps/Test_cmdheight_zero_2.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,6 ****
- |s+0&#e0e0e08|o|m|e| >t+0&#ffffff0|e|x|t| @65
- |~+0#4040ff13&| @73
- |~| @73
- |~| @73
- |~| @73
- |~| @73
--- 0 ----
*** ../vim-9.0.0339/src/testdir/dumps/Test_cmdheight_zero_3.dump 2022-08-28 13:02:23.955786926 +0100
--- src/testdir/dumps/Test_cmdheight_zero_3.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,6 ****
- |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
--- 0 ----
*** ../vim-9.0.0339/src/testdir/dumps/Test_cmdheight_zero_4.dump 2022-08-28 14:39:34.355253105 +0100
--- src/testdir/dumps/Test_cmdheight_zero_4.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,6 ****
- |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
--- 0 ----
*** ../vim-9.0.0339/src/testdir/dumps/Test_cmdheight_zero_5.dump 2022-08-28 20:58:26.863665631 +0100
--- src/testdir/dumps/Test_cmdheight_zero_5.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,6 ****
- |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
--- 0 ----
*** ../vim-9.0.0339/src/testdir/dumps/Test_cmdheight_zero_6.dump 2022-08-28 21:36:17.150095067 +0100
--- src/testdir/dumps/Test_cmdheight_zero_6.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,6 ****
- |s+0&#ffffff0|o|m|e| >t|e|x|t| @65
- |~+0#4040ff13&| @73
- |~| @73
- |~| @73
- |~| @73
- |~| @73
--- 0 ----
*** ../vim-9.0.0339/src/testdir/dumps/Test_cmdheight_zero_7.dump 2022-08-28 21:36:17.150095067 +0100
--- src/testdir/dumps/Test_cmdheight_zero_7.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,6 ****
- |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
--- 0 ----
*** ../vim-9.0.0339/src/testdir/dumps/Test_cmdheight_zero_8.dump 2022-08-28 21:36:17.150095067 +0100
--- src/testdir/dumps/Test_cmdheight_zero_8.dump 1970-01-01 00:00:00.000000000 +0000
***************
*** 1,6 ****
- |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
--- 0 ----
*** ../vim-9.0.0339/src/version.c 2022-08-31 12:01:49.849434433 +0100
--- src/version.c 2022-08-31 14:43:10.620873117 +0100
***************
*** 709,710 ****
--- 709,712 ----
{ /* Add new patch number below this line */
+ /**/
+ 340,
/**/

--
Looking at Perl through Lisp glasses, Perl looks atrocious.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages