aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval/funcs.c5
-rw-r--r--src/nvim/ex_cmds.c2
-rw-r--r--src/nvim/ex_getln.c2
-rw-r--r--src/nvim/message.c5
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/ops.c19
-rw-r--r--src/nvim/screen.c13
-rw-r--r--src/nvim/ui.c6
-rw-r--r--src/nvim/window.c6
-rw-r--r--test/functional/ui/cmdline_spec.lua2
10 files changed, 42 insertions, 20 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index f552c9916e..7454e9ddab 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -2899,6 +2899,11 @@ static void getchar_common(typval_T *argvars, typval_T *rettv)
no_mapping--;
allow_keys--;
+ if (!ui_has_messages()) {
+ // redraw the screen after getchar()
+ update_screen(CLEAR);
+ }
+
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/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index c65d9359ac..7edf4c5bcb 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3669,7 +3669,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
}
}
- bool cmdheight0 = p_ch < 1 && !ui_has(kUIMessages);
+ bool cmdheight0 = !ui_has_messages();
if (cmdheight0) {
// If cmdheight is 0, cmdheight must be set to 1 when we enter command line.
set_option_value("ch", 1L, NULL, 0);
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 4c17fdae02..815eeb8de5 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -689,7 +689,7 @@ static void finish_incsearch_highlighting(int gotesc, incsearch_state_T *s, bool
/// @param init_ccline clear ccline first
static uint8_t *command_line_enter(int firstc, long count, int indent, bool init_ccline)
{
- bool cmdheight0 = p_ch < 1 && !ui_has(kUIMessages);
+ bool cmdheight0 = !ui_has_messages();
if (cmdheight0) {
// If cmdheight is 0, cmdheight must be set to 1 when we enter command line.
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 80d11c096b..66c6cca561 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -493,6 +493,7 @@ int smsg(const char *s, ...)
va_start(arglist, s);
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
va_end(arglist);
+
return msg((char *)IObuff);
}
@@ -1389,7 +1390,7 @@ void msg_start(void)
need_fileinfo = false;
}
- bool no_msg_area = !ui_has(kUIMessages) && p_ch < 1;
+ bool no_msg_area = !ui_has_messages();
if (need_clr_eos || (no_msg_area && redrawing_cmdline)) {
// Halfway an ":echo" command and getting an (error) message: clear
@@ -3112,7 +3113,7 @@ void msg_clr_eos_force(void)
msg_row = msg_grid_pos;
}
- if (p_ch > 0) {
+ if (ui_has_messages()) {
grid_fill(&msg_grid_adj, msg_row, msg_row + 1, msg_startcol, msg_endcol,
' ', ' ', HL_ATTR(HLF_MSG));
grid_fill(&msg_grid_adj, msg_row + 1, Rows, 0, Columns,
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index e3bd4de9a0..fae22ce06f 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2810,7 +2810,7 @@ void pop_showcmd(void)
static void display_showcmd(void)
{
- if (p_ch < 1 && !ui_has(kUIMessages)) {
+ if (!ui_has_messages()) {
return;
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 21ab26898e..75ba8dbede 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -893,6 +893,7 @@ int do_record(int c)
{
char_u *p;
static int regname;
+ static bool change_cmdheight = false;
yankreg_T *old_y_previous;
int retval;
@@ -906,6 +907,13 @@ int do_record(int c)
showmode();
regname = c;
retval = OK;
+ if (!ui_has_messages()) {
+ // Enable macro indicator temporary
+ set_option_value("ch", 1L, NULL, 0);
+ update_screen(VALID);
+
+ change_cmdheight = true;
+ }
apply_autocmds(EVENT_RECORDINGENTER, NULL, NULL, false, curbuf);
}
} else { // stop recording
@@ -928,6 +936,15 @@ int do_record(int c)
(void)tv_dict_add_str(dict, S_LEN("regname"), buf);
tv_dict_set_keys_readonly(dict);
+ if (change_cmdheight) {
+ // Restore cmdheight
+ set_option_value("ch", 0L, NULL, 0);
+
+ redraw_all_later(CLEAR);
+
+ change_cmdheight = false;
+ }
+
// Get the recorded key hits. K_SPECIAL will be escaped, this
// needs to be removed again to put it in a register. exec_reg then
// adds the escaping back later.
@@ -2789,7 +2806,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
xfree(reg->y_array);
}
- if (message && (p_ch > 0 || ui_has(kUIMessages))) { // Display message about yank?
+ if (message) { // Display message about yank?
if (yank_type == kMTCharWise && yanklines == 1) {
yanklines = 0;
}
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 951ca3438e..a28c7c63b1 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -6143,10 +6143,6 @@ void unshowmode(bool force)
// Clear the mode message.
void clearmode(void)
{
- if (p_ch <= 0 && !ui_has(kUIMessages)) {
- return;
- }
-
const int save_msg_row = msg_row;
const int save_msg_col = msg_col;
@@ -6164,10 +6160,6 @@ void clearmode(void)
static void recording_mode(int attr)
{
- if (p_ch <= 0 && !ui_has(kUIMessages)) {
- return;
- }
-
msg_puts_attr(_("recording"), attr);
if (!shortmess(SHM_RECORDING)) {
char s[4];
@@ -6472,8 +6464,7 @@ int redrawing(void)
*/
int messaging(void)
{
- return !(p_lz && char_avail() && !KeyTyped)
- && (p_ch > 0 || ui_has(kUIMessages));
+ return !(p_lz && char_avail() && !KeyTyped) && ui_has_messages();
}
/// Show current status info in ruler and various other places
@@ -6587,7 +6578,7 @@ static void win_redr_ruler(win_T *wp, bool always)
off = 0;
}
- if (!part_of_status && p_ch < 1 && !ui_has(kUIMessages)) {
+ if (!part_of_status && !ui_has_messages()) {
return;
}
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index e958f02e32..4fcfee1192 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -612,6 +612,12 @@ bool ui_has(UIExtension ext)
return ui_ext[ext];
}
+/// Returns true if the UI has messages area.
+bool ui_has_messages(void)
+{
+ return p_ch > 0 || ui_has(kUIMessages);
+}
+
Array ui_array(void)
{
Array all_uis = ARRAY_DICT_INIT;
diff --git a/src/nvim/window.c b/src/nvim/window.c
index b2812189d9..0bd84c0269 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5877,7 +5877,7 @@ void win_setminheight(void)
// loop until there is a 'winminheight' that is possible
while (p_wmh > 0) {
const int room = Rows - (int)p_ch;
- const int needed = min_rows() - 1; // 1 was added for the cmdline
+ const int needed = min_rows();
if (room >= needed) {
break;
}
@@ -6830,7 +6830,9 @@ int min_rows(void)
}
}
total += tabline_height() + global_stl_height();
- total += 1; // count the room for the command line
+ if (p_ch > 0) {
+ total += 1; // count the room for the command line
+ }
return total;
}
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index f2b9173be1..db13647cc6 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -1103,7 +1103,7 @@ describe('cmdheight=0', function()
~ |
~ |
~ |
- ~ |
+ recording @q |
]], showmode={}}
feed('q')
screen:expect{grid=[[