aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 94ce1ec495..46cc4b5c7e 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -108,11 +108,9 @@ typedef enum {
kCmdRedrawAll,
} CmdRedraw;
-/*
- * Variables shared between getcmdline(), redrawcmdline() and others.
- * These need to be saved when using CTRL-R |, that's why they are in a
- * structure.
- */
+// Variables shared between getcmdline(), redrawcmdline() and others.
+// These need to be saved when using CTRL-R |, that's why they are in a
+// structure.
struct cmdline_info {
char_u *cmdbuff; // pointer to command line buffer
int cmdbufflen; // length of cmdbuff
@@ -139,6 +137,7 @@ struct cmdline_info {
bool special_shift; ///< shift of last putcmdline char
CmdRedraw redraw_state; ///< needed redraw for external cmdline
};
+
/// Last value of prompt_id, incremented when doing new prompt
static unsigned last_prompt_id = 0;
@@ -689,6 +688,14 @@ 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;
+
+ 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();
+ }
+
// can be invoked recursively, identify each level
static int cmdline_level = 0;
cmdline_level++;
@@ -976,6 +983,11 @@ theend:
ccline.cmdbuff = NULL;
}
+ if (cmdheight0) {
+ // Restore cmdheight
+ set_option_value("ch", 0L, NULL, 0);
+ }
+
return p;
}
@@ -2670,6 +2682,12 @@ char *getcmdline_prompt(const char firstc, const char *const prompt, const int a
return ret;
}
+// Return current cmdline prompt
+char_u *get_cmdprompt(void)
+{
+ return ccline.cmdprompt;
+}
+
/*
* Return TRUE when the text must not be changed and we can't switch to
* another window or buffer. Used when editing the command line etc.
@@ -3777,7 +3795,7 @@ void redrawcmd(void)
msg_no_more = TRUE;
draw_cmdline(0, ccline.cmdlen);
msg_clr_eos();
- msg_no_more = FALSE;
+ msg_no_more = false;
ccline.cmdspos = cmd_screencol(ccline.cmdpos);