aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2025-03-28 12:52:57 +0100
committerGitHub <noreply@github.com>2025-03-28 04:52:57 -0700
commit95ab723995f1cc1a11c62355fbac64597526d47e (patch)
tree2e9ae5f955d2d11517f6dc1a4d4ab8d23c0b80cf /src
parentade58885c478a46c1299f23f17a5c40e2960b6ad (diff)
downloadrneovim-95ab723995f1cc1a11c62355fbac64597526d47e.tar.gz
rneovim-95ab723995f1cc1a11c62355fbac64597526d47e.tar.bz2
rneovim-95ab723995f1cc1a11c62355fbac64597526d47e.zip
fix(cmdline): empty ext_cmdline block events for :<CR> #33118
Problem: An ext_cmdline block event that should be empty after :<CR> re-emits the previous cmdline. Solution: Clear `last_cmdline` even when `new_last_cmdline == NULL`.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_docmd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 6c5cca5d5c..d76a28750b 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -577,7 +577,8 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
int indent = cstack.cs_idx < 0 ? 0 : (cstack.cs_idx + 1) * 2;
if (count >= 1 && getline_equal(fgetline, cookie, getexline)) {
if (ui_has(kUICmdline)) {
- ui_ext_cmdline_block_append((size_t)MAX(0, block_indent), last_cmdline);
+ char *line = last_cmdline ? last_cmdline : "";
+ ui_ext_cmdline_block_append((size_t)MAX(0, block_indent), line);
block_indent = indent;
} else if (count == 1) {
// Need to set msg_didout for the first line after an ":if",
@@ -683,8 +684,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
// If the command was typed, remember it for the ':' register.
// Do this AFTER executing the command to make :@: work.
- if (getline_equal(fgetline, cookie, getexline)
- && new_last_cmdline != NULL) {
+ if (getline_equal(fgetline, cookie, getexline)) {
xfree(last_cmdline);
last_cmdline = new_last_cmdline;
new_last_cmdline = NULL;