diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2002-12-17 09:50:26 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2002-12-17 09:50:26 +0000 |
commit | c272d6fddd4213f503ff3f583ab5d7f3047b4f2b (patch) | |
tree | 17b3494e3e4b5e1c6a56afd7343302e19e175afc | |
parent | 4273666bc9c0539129ef4eebe14056849fd10913 (diff) |
Experimental: Introduce {next,previous}-new-then-unread. These
functions behave like {next,previous}-new as long as new messages
are visible. When no new messages are visibuel any more, there's a
fall-back to {next,prev}-unread.
Memo to self: Impose a weekly quota on the use of goto statements.
-rw-r--r-- | OPS | 2 | ||||
-rw-r--r-- | curs_main.c | 18 | ||||
-rw-r--r-- | functions.h | 12 |
3 files changed, 27 insertions, 5 deletions
@@ -105,6 +105,7 @@ OP_MAIN_FIRST_MESSAGE "move to the first message" OP_MAIN_LAST_MESSAGE "move to the last message" OP_MAIN_LIMIT "show only messages matching a pattern" OP_MAIN_NEXT_NEW "jump to the next new message" +OP_MAIN_NEXT_NEW_THEN_UNREAD "jump to the next new or unread message" 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" @@ -114,6 +115,7 @@ OP_MAIN_PREV_THREAD "jump to previous thread" OP_MAIN_PREV_SUBTHREAD "jump to previous subthread" OP_MAIN_PREV_UNDELETED "move to the previous undeleted message" OP_MAIN_PREV_NEW "jump to the previous new message" +OP_MAIN_PREV_NEW_THEN_UNREAD "jump to the previous new or unread message" 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" diff --git a/curs_main.c b/curs_main.c index 2f6198da..15f79558 100644 --- a/curs_main.c +++ b/curs_main.c @@ -1267,15 +1267,18 @@ int mutt_index_menu (void) case OP_MAIN_NEXT_UNREAD: case OP_MAIN_PREV_NEW: case OP_MAIN_PREV_UNREAD: + case OP_MAIN_NEXT_NEW_THEN_UNREAD: + case OP_MAIN_PREV_NEW_THEN_UNREAD: CHECK_MSGCOUNT; CHECK_VISIBLE; + next_unread_again: i = menu->current; menu->current = -1; for (j = 0; j != Context->vcount; j++) { #define CURHDRi Context->hdrs[Context->v2r[i]] - if (op == OP_MAIN_NEXT_NEW || op == OP_MAIN_NEXT_UNREAD) + if (op == OP_MAIN_NEXT_NEW || op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_NEXT_NEW_THEN_UNREAD) { i++; if (i > Context->vcount - 1) @@ -1302,7 +1305,8 @@ int mutt_index_menu (void) menu->current = i; break; } - if ((op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW) && + if ((op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW || + op == OP_MAIN_NEXT_NEW_THEN_UNREAD || op == OP_MAIN_PREV_NEW_THEN_UNREAD) && UNREAD (CURHDRi) == 1) { menu->current = i; @@ -1322,6 +1326,16 @@ int mutt_index_menu (void) if (menu->current == -1) { menu->current = menu->oldcurrent; + if (op == OP_MAIN_NEXT_NEW_THEN_UNREAD) + { + op = OP_MAIN_NEXT_UNREAD; + goto next_unread_again; + } + if (op == OP_MAIN_PREV_NEW_THEN_UNREAD) + { + op = OP_MAIN_PREV_UNREAD; + goto next_unread_again; + } mutt_error ("%s%s.", (op == OP_MAIN_NEXT_NEW || op == OP_MAIN_PREV_NEW) ? _("No new messages") : _("No unread messages"), Context->pattern ? _(" in this limited view") : ""); } diff --git a/functions.h b/functions.h index 9e80de3a..accb9448 100644 --- a/functions.h +++ b/functions.h @@ -130,8 +130,10 @@ struct binding_t OpMain[] = { { "sync-mailbox", OP_MAIN_SYNC_FOLDER, "$" }, { "display-address", OP_DISPLAY_ADDRESS, "@" }, { "pipe-message", OP_PIPE, "|" }, - { "next-new", OP_MAIN_NEXT_NEW, "\t" }, - { "previous-new", OP_MAIN_PREV_NEW, "\033\t" }, + { "next-new", OP_MAIN_NEXT_NEW, NULL }, + { "next-new-then-unread", OP_MAIN_NEXT_NEW_THEN_UNREAD, "\t" }, + { "previous-new", OP_MAIN_PREV_NEW, NULL }, + { "previous-new-then-unread", OP_MAIN_PREV_NEW_THEN_UNREAD, "\033\t" }, { "next-unread", OP_MAIN_NEXT_UNREAD, NULL }, { "previous-unread", OP_MAIN_PREV_UNREAD, NULL }, { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" }, @@ -205,7 +207,9 @@ struct binding_t OpPager[] = { { "show-version", OP_VERSION, "V" }, { "search-toggle", OP_SEARCH_TOGGLE, "\\" }, { "display-address", OP_DISPLAY_ADDRESS, "@" }, - { "next-new", OP_MAIN_NEXT_NEW, "\t" }, + { "next-new", OP_MAIN_NEXT_NEW, NULL }, + { "next-new-then-unread", + OP_MAIN_NEXT_NEW_THEN_UNREAD, "\t" }, { "pipe-message", OP_PIPE, "|" }, { "help", OP_HELP, "?" }, { "next-page", OP_NEXT_PAGE, " " }, @@ -222,6 +226,8 @@ struct binding_t OpPager[] = { { "jump", OP_JUMP, NULL }, { "next-unread", OP_MAIN_NEXT_UNREAD, NULL }, { "previous-new", OP_MAIN_PREV_NEW, NULL }, + { "previous-new-then-unread", + OP_MAIN_PREV_NEW_THEN_UNREAD, NULL }, { "previous-unread", OP_MAIN_PREV_UNREAD, NULL }, { "half-up", OP_HALF_UP, NULL }, { "half-down", OP_HALF_DOWN, NULL }, |