]> granicus.if.org Git - mutt/commitdiff
Add a comment to the OPTIGNOREMACROEVENTS km_dokey() change.
authorKevin McCarthy <kevin@8t8.us>
Sun, 28 Jul 2019 17:13:22 +0000 (10:13 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sun, 28 Jul 2019 17:24:20 +0000 (10:24 -0700)
The option was added in commit 53900afa, and its actual purpose was
to separate out an "unget" event buffer from the "macro" buffer, to
solve a problem with certificate prompts.

The safest approach in a low-level function like km_dokey() was to
return an error if new macros were generated when the option is set.
However, this results in an unbuffered username/password prompt being
aborted.

Currently the only users of unbuffered input are the SSL certificate
prompts, which use menu->dialog mode (and thus mutt_getch() directly)
and username/password prompts.  So the only affected cases are
editor-menu prompts, and returning the pressed keys is likely less
surprising than aborting the prompt.

If other unbuffered menus are created in the future, we may want to
add a check for which menu mode is being used.

keymap.c

index 1fa00de7f3b31ad5821ece3003f10138679b877e..eabd48ad7fa617fcf941e0f060d95d156ef7b67c 100644 (file)
--- a/keymap.c
+++ b/keymap.c
@@ -542,6 +542,17 @@ int km_dokey (int menu)
       if (map->op != OP_MACRO)
        return map->op;
 
+      /* OPTIGNOREMACROEVENTS turns off processing the MacroEvents buffer
+       * in mutt_getch().  Generating new macro events during that time would
+       * result in undesired behavior once the option is turned off.
+       *
+       * Originally this returned -1, however that results in an unbuffered
+       * username or password prompt being aborted.  Returning OP_NULL allows
+       * _mutt_enter_string() to display the keybinding pressed instead.
+       *
+       * It may be unexpected for a macro's keybinding to be returned,
+       * but less so than aborting the prompt.
+       */
       if (option (OPTIGNOREMACROEVENTS))
       {
        return OP_NULL;