mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 23:06:14 +00:00
fix(messages): recognize cmdline one_key/number prompt State (#34206)
Problem: Since 48e2a736
, prompt messages are handled by an actual
active cmdline, resulting in `State` no longer being equal
to `MODE_CONFIRM` which is used in some places. E.g. to
specify the current `mode()` or to re-emit a confirm message.
Solution: Replace `MODE_CONFIRM` with a new `MODE_CMDLINE` sub-mode when
`ccline.one_key/mouse_used` is set. Use it to avoid clearing
mouse_used prompt messages, and to re-emit one_key messages
(when ext_messages is inactive, for which this is unnecessary).
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "nvim/ex_cmds_defs.h"
|
||||
#include "nvim/ex_docmd.h"
|
||||
#include "nvim/ex_eval.h"
|
||||
#include "nvim/ex_getln.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
@@ -3072,13 +3073,17 @@ void msg_moremsg(bool full)
|
||||
}
|
||||
|
||||
/// Repeat the message for the current mode: MODE_ASKMORE, MODE_EXTERNCMD,
|
||||
/// MODE_CONFIRM or exmode_active.
|
||||
/// confirm() prompt or exmode_active.
|
||||
void repeat_message(void)
|
||||
{
|
||||
if (ui_has(kUIMessages)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (State == MODE_ASKMORE) {
|
||||
msg_moremsg(true); // display --more-- message again
|
||||
msg_row = Rows - 1;
|
||||
} else if (State == MODE_CONFIRM) {
|
||||
} else if (State == MODE_CMDLINE && confirm_msg != NULL) {
|
||||
display_confirm_msg(); // display ":confirm" message again
|
||||
msg_row = Rows - 1;
|
||||
} else if (State == MODE_EXTERNCMD) {
|
||||
@@ -3550,8 +3555,6 @@ int do_dialog(int type, const char *title, const char *message, const char *butt
|
||||
int oldState = State;
|
||||
|
||||
msg_silent = 0; // If dialog prompts for input, user needs to see it! #8788
|
||||
State = MODE_CONFIRM;
|
||||
setmouse();
|
||||
|
||||
// Since we wait for a keypress, don't make the
|
||||
// user press RETURN as well afterwards.
|
||||
@@ -3608,6 +3611,8 @@ int do_dialog(int type, const char *title, const char *message, const char *butt
|
||||
}
|
||||
|
||||
xfree(hotkeys);
|
||||
xfree(confirm_msg);
|
||||
confirm_msg = NULL;
|
||||
|
||||
msg_silent = save_msg_silent;
|
||||
State = oldState;
|
||||
@@ -3688,7 +3693,6 @@ static char *console_dialog_alloc(const char *message, const char *buttons, bool
|
||||
}
|
||||
|
||||
// Now allocate space for the strings
|
||||
xfree(confirm_msg);
|
||||
confirm_msg = xmalloc((size_t)msg_len);
|
||||
snprintf(confirm_msg, (size_t)msg_len, "\n%s\n", message);
|
||||
|
||||
|
Reference in New Issue
Block a user