aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index e099c9b0a5..281270155a 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -21,6 +21,7 @@
#include "nvim/eval.h"
#include "nvim/ex_eval.h"
#include "nvim/fileio.h"
+#include "nvim/func_attr.h"
#include "nvim/getchar.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
@@ -2710,51 +2711,49 @@ do_dialog (
++no_wait_return;
hotkeys = msg_show_console_dialog(message, buttons, dfltbutton);
- if (hotkeys != NULL) {
- for (;; ) {
- /* Get a typed character directly from the user. */
- c = get_keystroke();
- switch (c) {
- case CAR: /* User accepts default option */
- case NL:
+ for (;; ) {
+ /* Get a typed character directly from the user. */
+ c = get_keystroke();
+ switch (c) {
+ case CAR: /* User accepts default option */
+ case NL:
+ retval = dfltbutton;
+ break;
+ case Ctrl_C: /* User aborts/cancels */
+ case ESC:
+ retval = 0;
+ break;
+ default: /* Could be a hotkey? */
+ if (c < 0) /* special keys are ignored here */
+ continue;
+ if (c == ':' && ex_cmd) {
retval = dfltbutton;
+ ins_char_typebuf(':');
break;
- case Ctrl_C: /* User aborts/cancels */
- case ESC:
- retval = 0;
- break;
- default: /* Could be a hotkey? */
- if (c < 0) /* special keys are ignored here */
- continue;
- if (c == ':' && ex_cmd) {
- retval = dfltbutton;
- ins_char_typebuf(':');
- break;
- }
+ }
- /* Make the character lowercase, as chars in "hotkeys" are. */
- c = vim_tolower(c);
- retval = 1;
- for (i = 0; hotkeys[i]; ++i) {
- if (has_mbyte) {
- if ((*mb_ptr2char)(hotkeys + i) == c)
- break;
- i += (*mb_ptr2len)(hotkeys + i) - 1;
- } else if (hotkeys[i] == c)
+ /* Make the character lowercase, as chars in "hotkeys" are. */
+ c = vim_tolower(c);
+ retval = 1;
+ for (i = 0; hotkeys[i]; ++i) {
+ if (has_mbyte) {
+ if ((*mb_ptr2char)(hotkeys + i) == c)
break;
- ++retval;
- }
- if (hotkeys[i])
+ i += (*mb_ptr2len)(hotkeys + i) - 1;
+ } else if (hotkeys[i] == c)
break;
- /* No hotkey match, so keep waiting */
- continue;
+ ++retval;
}
- break;
+ if (hotkeys[i])
+ break;
+ /* No hotkey match, so keep waiting */
+ continue;
}
-
- free(hotkeys);
+ break;
}
+ free(hotkeys);
+
State = oldState;
setmouse();
--no_wait_return;
@@ -2868,9 +2867,10 @@ static char_u * console_dialog_alloc(const char_u *message,
* the button is used.
* The hotkeys can be multi-byte characters, but without combining chars.
*
- * Returns an allocated string with hotkeys, or NULL for error.
+ * Returns an allocated string with hotkeys.
*/
static char_u *msg_show_console_dialog(char_u *message, char_u *buttons, int dfltbutton)
+ FUNC_ATTR_NONNULL_RET
{
bool has_hotkey[HAS_HOTKEY_LEN];
char_u *hotk = console_dialog_alloc(message, buttons, has_hotkey);