patch 9.1.1351: Return value of getcmdline() inconsistent in CmdlineLeavePre

Problem:  Return value of getcmdline() inconsistent in CmdlineLeavePre
          when leaving cmdline in different ways (after v9.1.1329).
Solution: Trigger CmdlineLeavePre before calling abandon_cmdline() so
          that getcmdline() can return the command line (zeertzjq).

closes: #17218

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2025-04-28 18:04:00 +02:00
committed by Christian Brabandt
parent 6220bbad4e
commit 9240369774
3 changed files with 27 additions and 9 deletions

View File

@ -2560,6 +2560,9 @@ cmdline_changed:
}
returncmd:
// Trigger CmdlineLeavePre autocommands if not already triggered.
if (!event_cmdlineleavepre_triggered)
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVEPRE);
#ifdef FEAT_RIGHTLEFT
cmdmsg_rl = FALSE;
@ -2616,10 +2619,6 @@ returncmd:
if (some_key_typed)
need_wait_return = FALSE;
// Trigger CmdlineLeavePre autocommands if not already triggered.
if (!event_cmdlineleavepre_triggered)
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVEPRE);
// Trigger CmdlineLeave autocommands.
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE);