diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-14 16:28:05 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2024-07-14 16:33:07 +0800 |
commit | c8401515cdaad20220e30f5a0c39ddb7bae77f5e (patch) | |
tree | b4532a00a60eefe2aee77e7bdbf7ef1eb769c9da /src/nvim/ex_docmd.c | |
parent | ba36742211eea55bed2ffbca129a45023967f204 (diff) | |
download | rneovim-c8401515cdaad20220e30f5a0c39ddb7bae77f5e.tar.gz rneovim-c8401515cdaad20220e30f5a0c39ddb7bae77f5e.tar.bz2 rneovim-c8401515cdaad20220e30f5a0c39ddb7bae77f5e.zip |
vim-patch:9.1.0582: Printed line doesn't overwrite colon when pressing Enter in Ex mode
Problem: Printed line no longer overwrites colon when pressing Enter in
Ex mode (after 9.1.0573).
Solution: Restore the behavior of pressing Enter in Ex mode.
(zeertzjq)
closes: vim/vim#15258
https://github.com/vim/vim/commit/7d664bf0eb2cb25cb77933c8b7f11ca09929e7b8
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 1d20829d3c..b252ba2b20 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2426,13 +2426,17 @@ char *ex_errmsg(const char *const msg, const char *const arg) return ex_error_buf; } +/// The "+" string used in place of an empty command in Ex mode. +/// This string is used in pointer comparison. +static char exmode_plus[] = "+"; + /// Handle a range without a command. /// Returns an error message on failure. static char *ex_range_without_command(exarg_T *eap) { char *errormsg = NULL; - if (*eap->cmd == '|' || exmode_active) { + if (*eap->cmd == '|' || (exmode_active && eap->cmd != exmode_plus + 1)) { eap->cmdidx = CMD_print; eap->argt = EX_RANGE | EX_COUNT | EX_TRLBAR; if ((errormsg = invalid_range(eap)) == NULL) { @@ -2491,7 +2495,7 @@ int parse_command_modifiers(exarg_T *eap, const char **errormsg, cmdmod_T *cmod, if (*eap->cmd == NUL && exmode_active && getline_equal(eap->ea_getline, eap->cookie, getexline) && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { - eap->cmd = "+"; + eap->cmd = exmode_plus; if (!skip_only) { ex_pressedreturn = true; } |