OP_MAIN_PREV_UNREAD "jump to the previous unread message"
OP_MAIN_READ_THREAD "mark the current thread as read"
OP_MAIN_READ_SUBTHREAD "mark the current subthread as read"
+OP_MAIN_ROOT_MESSAGE "jump to root message in thread"
OP_MAIN_SET_FLAG "set a status flag on a message"
OP_MAIN_SYNC_FOLDER "save changes to mailbox"
OP_MAIN_TAG_PATTERN "tag messages matching a pattern"
}
if ((Sort & SORT_MASK) == SORT_THREADS && menu->current < 0)
- menu->current = mutt_parent_message (Context, current);
+ menu->current = mutt_parent_message (Context, current, 0);
if (menu->current < 0)
menu->current = ci_first_message ();
menu->redraw = REDRAW_MOTION;
break;
+ case OP_MAIN_ROOT_MESSAGE:
case OP_MAIN_PARENT_MESSAGE:
CHECK_MSGCOUNT;
CHECK_VISIBLE;
- if ((menu->current = mutt_parent_message (Context, CURHDR)) < 0)
+ if ((menu->current = mutt_parent_message (Context, CURHDR,
+ op == OP_MAIN_ROOT_MESSAGE)) < 0)
{
menu->current = menu->oldcurrent;
}
{ "next-unread", OP_MAIN_NEXT_UNREAD, NULL },
{ "previous-unread", OP_MAIN_PREV_UNREAD, NULL },
{ "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
+ { "root-message", OP_MAIN_ROOT_MESSAGE, NULL },
{ "extract-keys", OP_EXTRACT_KEYS, "\013" },
{ "previous-line", OP_PREV_LINE, NULL },
{ "bottom", OP_PAGER_BOTTOM, NULL },
{ "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
+ { "root-message", OP_MAIN_ROOT_MESSAGE, NULL },
int mutt_chscmp (const char *s, const char *chs);
#define mutt_is_utf8(a) mutt_chscmp (a, "utf-8")
#define mutt_is_us_ascii(a) mutt_chscmp (a, "us-ascii")
-int mutt_parent_message (CONTEXT *, HEADER *);
+int mutt_parent_message (CONTEXT *, HEADER *, int);
int mutt_prepare_template(FILE*, CONTEXT *, HEADER *, HEADER *, short);
int mutt_resend_message (FILE *, CONTEXT *, HEADER *);
#define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
return (tmp->virtual);
}
-int mutt_parent_message (CONTEXT *ctx, HEADER *hdr)
+int mutt_parent_message (CONTEXT *ctx, HEADER *hdr, int find_root)
{
THREAD *thread;
+ HEADER *parent = NULL;
if ((Sort & SORT_MASK) != SORT_THREADS)
{
return (hdr->virtual);
}
+ /* Root may be the current message */
+ if (find_root)
+ parent = hdr;
+
for (thread = hdr->thread->parent; thread; thread = thread->parent)
{
if ((hdr = thread->message) != NULL)
{
- if (VISIBLE (hdr, ctx))
- return (hdr->virtual);
- else
- {
- mutt_error _("Parent message is not visible in this limited view.");
- return (-1);
- }
+ parent = hdr;
+ if (!find_root)
+ break;
}
}
-
- mutt_error _("Parent message is not available.");
- return (-1);
+
+ if (!parent)
+ {
+ mutt_error _("Parent message is not available.");
+ return (-1);
+ }
+ if (!VISIBLE (parent, ctx))
+ {
+ if (find_root)
+ mutt_error _("Root message is not visible in this limited view.");
+ else
+ mutt_error _("Parent message is not visible in this limited view.");
+ return (-1);
+ }
+ return (parent->virtual);
}
void mutt_set_virtual (CONTEXT *ctx)