From d0656b2b38fedc0780dc53f3d42c5b4dbc96fa97 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Tue, 31 Aug 1999 19:11:53 +0000 Subject: [PATCH] Adding a function. From Roland Rosenfeld . --- OPS | 1 + curs_main.c | 17 +++++++++++++++++ doc/manual.sgml.head | 1 + doc/manual.sgml.tail | 2 ++ functions.h | 4 ++-- protos.h | 1 + thread.c | 24 ++++++++++++++++++++++++ 7 files changed, 48 insertions(+), 2 deletions(-) diff --git a/OPS b/OPS index 23a60fee..997488c8 100644 --- a/OPS +++ b/OPS @@ -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" diff --git a/curs_main.c b/curs_main.c index fcf83640..9f26a0f8 100644 --- a/curs_main.c +++ b/curs_main.c @@ -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: diff --git a/doc/manual.sgml.head b/doc/manual.sgml.head index 0813a052..0d7ed08a 100644 --- a/doc/manual.sgml.head +++ b/doc/manual.sgml.head @@ -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 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; -- 2.40.0