Commit d0656b2b authored by Thomas Roessler's avatar Thomas Roessler

Adding a <parent-message> function. From Roland Rosenfeld

<roland@spinnaker.rhein.de>.
parent 018280d4
......@@ -98,6 +98,7 @@ OP_MAIN_NEXT_SUBTHREAD "jump to the next subthread"
OP_MAIN_NEXT_THREAD "jump to the next thread"
OP_MAIN_NEXT_UNDELETED "move to the next undeleted message"
OP_MAIN_NEXT_UNREAD "jump to the next unread message"
OP_MAIN_PARENT_MESSAGE "jump to parent message in thread"
OP_MAIN_PREV_THREAD "jump to previous thread"
OP_MAIN_PREV_SUBTHREAD "jump to previous subthread"
OP_MAIN_PREV_UNDELETED "move to the last undelete message"
......
......@@ -1310,6 +1310,23 @@ int mutt_index_menu (void)
menu->redraw = REDRAW_MOTION;
break;
case OP_MAIN_PARENT_MESSAGE:
CHECK_MSGCOUNT;
if ((menu->current = mutt_parent_message (Context, CURHDR)) < 0)
{
menu->current = menu->oldcurrent;
}
else if (menu->menu == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
continue;
}
else
menu->redraw = REDRAW_MOTION;
break;
case OP_MAIN_SET_FLAG:
case OP_MAIN_CLEAR_FLAG:
......
......@@ -304,6 +304,7 @@ ESC r read-subthread mark the current subthread as read
ESC t tag-thread toggle the tag on the current thread
ESC v collapse-thread toggle collapse for the current thread
ESC V collapse-all toggle collapse for all threads
P parent-message jump to parent message in thread
</verb></tscreen>
<bf/Note:/ Collapsing a thread displays only the first message
......
......@@ -80,6 +80,7 @@ next-subthread ESC n jump to the next subthread
next-thread ^N jump to the next thread
next-undeleted j move to the next undeleted message
next-unread not bound jump to the next unread message
parent-message P jump to parent message in thread
pipe-message | pipe message/attachment to a shell command
previous-new ESC TAB jump to the previous new message
previous-page Z move to the previous page
......@@ -151,6 +152,7 @@ next-subthread ESC n jump to the next subthread
next-thread ^N jump to the next thread
next-undeleted j move to the next undeleted message
next-unread not bound jump to the next unread message
parent-message P jump to parent message in thread
pipe-message | pipe message/attachment to a shell command
previous-line BackSpace scroll up one line
previous-entry K move to the previous entry
......
......@@ -127,7 +127,7 @@ struct binding_t OpMain[] = {
{ "previous-new", OP_MAIN_PREV_NEW, "\033\t" },
{ "next-unread", OP_MAIN_NEXT_UNREAD, NULL },
{ "previous-unread", OP_MAIN_PREV_UNREAD, NULL },
{ "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
#ifdef _PGPPATH
......@@ -210,7 +210,7 @@ struct binding_t OpPager[] = {
{ "half-up", OP_HALF_UP, NULL },
{ "half-down", OP_HALF_DOWN, NULL },
{ "previous-line", OP_PREV_LINE, NULL },
{ "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
......
......@@ -215,6 +215,7 @@ int mutt_compose_attachment (BODY *a);
int mutt_decode_save_attachment (FILE *, BODY *, char *, int, int);
int mutt_display_message (HEADER *h);
int mutt_edit_attachment(BODY *);
int mutt_parent_message (CONTEXT *, HEADER *);
int mutt_prepare_edit_message(CONTEXT *, HEADER *, HEADER *);
#define mutt_enter_fname(A,B,C,D,E) _mutt_enter_fname(A,B,C,D,E,0,NULL,NULL)
int _mutt_enter_fname (const char *, char *, size_t, int *, int, int, char ***, int *);
......
......@@ -705,6 +705,30 @@ int _mutt_aside_thread (HEADER *hdr, short dir, short subthreads)
return (tmp->virtual);
}
int mutt_parent_message (CONTEXT *ctx, HEADER *hdr)
{
if ((Sort & SORT_MASK) != SORT_THREADS)
{
mutt_error _("Threading is not enabled.");
return (hdr->virtual);
}
if (hdr->parent)
{
while ((hdr = hdr->parent))
{
if (!ctx->pattern || hdr->limited)
return (hdr->virtual);
}
mutt_error _("Parent message is not visible in limited view");
return -1;
}
else
{
mutt_error _("Parent message is not available.");
return -1;
}
}
void mutt_set_virtual (CONTEXT *ctx)
{
int i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment