summaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2017-06-01 15:17:05 -0700
committerKevin McCarthy <kevin@8t8.us>2017-06-01 15:17:05 -0700
commit35ae06c18b416c207320c44cc5b8b6cb390792f1 (patch)
treeb9e405cf7f0a4fcbc3a7d45f798fa3a52ec2002b /menu.c
parent054164bf31c1c304684e6a9595823612b2c903bf (diff)
Fix tag-prefix to not abort on $timeout.
If $timeout is set very low, then it can cancel the tag-prefix before the user has time to press the desired command. Change the code to set the tag flag, and then recontinue with normal event processing instead. Cancel on an abort, but continue with a timeout. Thanks to Lauri Tirkkonen for reporting the issue.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/menu.c b/menu.c
index 0e09c780..9605d73f 100644
--- a/menu.c
+++ b/menu.c
@@ -979,19 +979,30 @@ int mutt_menuLoop (MUTTMENU *menu)
unset_option (OPTMENUCALLER);
return OP_NULL;
}
-
-
+
+ /* Clear the tag prefix unless we just started it. Don't clear
+ * the prefix on a timeout (i==-2), but do clear on an abort (i==-1)
+ */
+ if (menu->tagprefix &&
+ i != OP_TAG_PREFIX && i != OP_TAG_PREFIX_COND && i != -2)
+ menu->tagprefix = 0;
+
mutt_curs_set (0);
if (menu_redraw (menu) == OP_REDRAW)
return OP_REDRAW;
-
+
+ /* give visual indication that the next command is a tag- command */
+ if (menu->tagprefix)
+ {
+ mutt_window_mvaddstr (menu->messagewin, 0, 0, "tag-");
+ mutt_window_clrtoeol (menu->messagewin);
+ }
+
menu->oldcurrent = menu->current;
/* move the cursor out of the way */
-
-
if (option (OPTARROWCURSOR))
mutt_window_move (menu->indexwin, menu->current - menu->top + menu->offset, 2);
else if (option (OPTBRAILLEFRIENDLY))
@@ -1001,21 +1012,25 @@ int mutt_menuLoop (MUTTMENU *menu)
menu->indexwin->cols - 1);
mutt_refresh ();
-
+
/* try to catch dialog keys before ops */
if (menu->dialog && menu_dialog_dokey (menu, &i) == 0)
return i;
-
+
i = km_dokey (menu->menu);
if (i == OP_TAG_PREFIX || i == OP_TAG_PREFIX_COND)
{
+ if (menu->tagprefix)
+ {
+ menu->tagprefix = 0;
+ mutt_window_clearline (menu->messagewin, 0);
+ continue;
+ }
+
if (menu->tagged)
{
- mutt_window_mvaddstr (menu->messagewin, 0, 0, "Tag-");
- mutt_window_clrtoeol (menu->messagewin);
- i = km_dokey (menu->menu);
menu->tagprefix = 1;
- mutt_window_clearline (menu->messagewin, 0);
+ continue;
}
else if (i == OP_TAG_PREFIX)
{
@@ -1031,8 +1046,6 @@ int mutt_menuLoop (MUTTMENU *menu)
}
else if (menu->tagged && option (OPTAUTOTAG))
menu->tagprefix = 1;
- else
- menu->tagprefix = 0;
mutt_curs_set (1);
@@ -1046,7 +1059,11 @@ int mutt_menuLoop (MUTTMENU *menu)
#endif
if (i < 0)
+ {
+ if (menu->tagprefix)
+ mutt_window_clearline (menu->messagewin, 0);
continue;
+ }
if (!menu->dialog)
mutt_clear_error ();