while (true)
{
- tag = 0; /* clear the tag-prefix */
+ /* Clear the tag prefix unless we just started it. Don't clear
+ * the prefix on a timeout (op==-2), but do clear on an abort (op==-1)
+ */
+ if (tag && op != OP_TAG_PREFIX && op != OP_TAG_PREFIX_COND && op != -2)
+ tag = 0;
/* check if we need to resort the index because just about
* any 'op' below could do mutt_enter_command(), either here or
{
index_menu_redraw(menu);
+ /* give visual indication that the next command is a tag- command */
+ if (tag)
+ {
+ mutt_window_mvaddstr(MuttMessageWindow, 0, 0, "tag-");
+ mutt_window_clrtoeol(MuttMessageWindow);
+ }
+
if (menu->current < menu->max)
menu->oldcurrent = menu->current;
else
mutt_debug(4, "mutt_index_menu[%d]: Got op %d\n", __LINE__, op);
+ /* either user abort or timeout */
if (op < 0)
{
mutt_timeout_hook();
- continue; /* either user abort or timeout */
+ if (tag)
+ mutt_window_clearline(MuttMessageWindow, 0);
+ continue;
}
mutt_curs_set(1);
/* special handling for the tag-prefix function */
- if (op == OP_TAG_PREFIX)
+ if (op == OP_TAG_PREFIX || op == OP_TAG_PREFIX_COND)
{
- if (!Context)
- {
- mutt_error(_("No mailbox is open."));
- continue;
- }
-
- if (!Context->tagged)
- {
- mutt_error(_("No tagged messages."));
- continue;
- }
- tag = 1;
-
- /* give visual indication that the next command is a tag- command */
- mutt_window_mvaddstr(MuttMessageWindow, 0, 0, "tag-");
- mutt_window_clrtoeol(MuttMessageWindow);
-
- /* get the real command */
- if ((op = km_dokey(MENU_MAIN)) == OP_TAG_PREFIX)
+ /* A second tag-prefix command aborts */
+ if (tag)
{
- /* abort tag sequence */
+ tag = 0;
mutt_window_clearline(MuttMessageWindow, 0);
continue;
}
- }
- else if (option(OPTAUTOTAG) && Context && Context->tagged)
- tag = 1;
- if (op == OP_TAG_PREFIX_COND)
- {
if (!Context)
{
mutt_error(_("No mailbox is open."));
if (!Context->tagged)
{
- mutt_flush_macro_to_endcond();
- mutt_message(_("Nothing to do."));
+ if (op == OP_TAG_PREFIX)
+ mutt_error(_("No tagged messages."));
+ else if (op == OP_TAG_PREFIX_COND)
+ {
+ mutt_flush_macro_to_endcond();
+ mutt_message(_("Nothing to do."));
+ }
continue;
}
- tag = 1;
-
- /* give visual indication that the next command is a tag- command */
- mutt_window_mvaddstr(MuttMessageWindow, 0, 0, "tag-");
- mutt_window_clrtoeol(MuttMessageWindow);
/* get the real command */
- if ((op = km_dokey(MENU_MAIN)) == OP_TAG_PREFIX)
- {
- /* abort tag sequence */
- mutt_window_clearline(MuttMessageWindow, 0);
- continue;
- }
+ tag = 1;
+ continue;
}
+ else if (option(OPTAUTOTAG) && Context && Context->tagged)
+ tag = 1;
mutt_clear_error();
}
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))
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)
{
}
else if (menu->tagged && option(OPTAUTOTAG))
menu->tagprefix = 1;
- else
- menu->tagprefix = 0;
mutt_curs_set(1);
#endif
if (i < 0)
+ {
+ if (menu->tagprefix)
+ mutt_window_clearline(menu->messagewin, 0);
continue;
+ }
if (!menu->dialog)
mutt_clear_error();