diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.c | 12 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 7 | ||||
-rw-r--r-- | src/nvim/message.c | 9 | ||||
-rw-r--r-- | src/nvim/ops.c | 2 | ||||
-rw-r--r-- | src/nvim/screen.c | 9 | ||||
-rw-r--r-- | src/nvim/window.c | 7 |
6 files changed, 34 insertions, 12 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 45d08d40bc..82422a78c3 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -3651,6 +3651,13 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T sub_needs_free = cmdpreview && sub != source; } + bool cmdheight0 = p_ch < 1 && !ui_has(kUIMessages); + if (cmdheight0) { + // If cmdheight is 0, cmdheight must be set to 1 when we enter command line. + set_option_value("ch", 1L, NULL, 0); + redraw_statuslines(); + } + // Check for a match on each line. // If preview: limit to max('cmdwinheight', viewport). linenr_T line2 = eap->line2; @@ -4461,6 +4468,11 @@ skip: } } + if (cmdheight0) { + // Restore cmdheight + set_option_value("ch", 0L, NULL, 0); + } + kv_destroy(preview_lines.subresults); return retv; #undef ADJUST_SUB_FIRSTLNUM diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 01f16f3383..49f946d6c0 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -688,12 +688,12 @@ 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) && vpeekc() == NUL; + bool cmdheight0 = p_ch < 1 && !ui_has(kUIMessages); if (cmdheight0) { // If cmdheight is 0, cmdheight must be set to 1 when we enter command line. set_option_value("ch", 1L, NULL, 0); - redraw_statuslines(); + update_screen(VALID); // redraw the screen NOW } // can be invoked recursively, identify each level @@ -985,6 +985,9 @@ theend: if (cmdheight0) { // Restore cmdheight set_option_value("ch", 0L, NULL, 0); + + // Redraw is needed for command line completion + redraw_all_later(CLEAR); } return p; diff --git a/src/nvim/message.c b/src/nvim/message.c index 733b4808fe..0cd323c234 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -891,7 +891,7 @@ char_u *msg_may_trunc(bool force, char_u *s) room = (Rows - cmdline_row - 1) * Columns + sc_col - 1; if ((force || (shortmess(SHM_TRUNC) && !exmode_active)) - && (int)STRLEN(s) - room > 0) { + && (int)STRLEN(s) - room > 0 && p_ch > 0) { int size = vim_strsize((char *)s); // There may be room anyway when there are multibyte chars. @@ -3083,10 +3083,11 @@ void msg_clr_eos_force(void) msg_row = msg_grid_pos; } - grid_fill(&msg_grid_adj, msg_row, msg_row + 1, msg_startcol, msg_endcol, - ' ', ' ', HL_ATTR(HLF_MSG)); if (p_ch > 0) { - grid_fill(&msg_grid_adj, msg_row + 1, Rows, 0, Columns, ' ', ' ', HL_ATTR(HLF_MSG)); + 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, + ' ', ' ', HL_ATTR(HLF_MSG)); } redraw_cmdline = true; // overwritten the command line diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 42beb2e16d..639b7fd738 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -2791,7 +2791,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append) xfree(reg->y_array); } - if (message) { // Display message about yank? + if (message && (p_ch > 0 || ui_has(kUIMessages))) { // 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 ea75900ded..bc11883fd8 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -6153,6 +6153,10 @@ 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]; @@ -6457,7 +6461,8 @@ int redrawing(void) */ int messaging(void) { - return !(p_lz && char_avail() && !KeyTyped); + return !(p_lz && char_avail() && !KeyTyped) + && (p_ch > 0 || ui_has(kUIMessages)); } /// Show current status info in ruler and various other places @@ -6515,7 +6520,7 @@ static void win_redr_ruler(win_T *wp, bool always) } } - if (*p_ruf) { + if (*p_ruf && p_ch > 0 && !ui_has(kUIMessages)) { int save_called_emsg = called_emsg; called_emsg = false; win_redr_custom(wp, false, true); diff --git a/src/nvim/window.c b/src/nvim/window.c index 9b9a2126ff..9ac027d80f 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5560,9 +5560,10 @@ static void frame_setheight(frame_T *curfrp, int height) if (curfrp->fr_parent == NULL) { // topframe: can only change the command line if (height > ROWS_AVAIL) { - // If height is greater than the available space, try to create space for the frame by - // reducing 'cmdheight' if possible, while making sure `cmdheight` doesn't go below 1. - height = MIN(ROWS_AVAIL + (p_ch - 1), height); + // If height is greater than the available space, try to create space for + // the frame by reducing 'cmdheight' if possible, while making sure + // `cmdheight` doesn't go below 1. + height = MIN((p_ch > 0 ? ROWS_AVAIL + (p_ch - 1) : ROWS_AVAIL), height); } if (height > 0) { frame_new_height(curfrp, height, false, false); |