diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2000-11-17 09:17:55 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2000-11-17 09:17:55 +0000 |
commit | 4e7bcaa0ebd6aee658d22be3c64542d59603b335 (patch) | |
tree | c9c5b46e7e2ad4fa67c9928aed15d4c9b84d5d65 | |
parent | d83c672d4f54cd2c3129b71352b425654d2890ba (diff) |
Make folder synchronization possible from within the pager. From
Chris Cutler <cutler@bluemug.com>.
-rw-r--r-- | curs_main.c | 92 | ||||
-rw-r--r-- | doc/manual.sgml.tail | 3 | ||||
-rw-r--r-- | functions.h | 3 |
3 files changed, 54 insertions, 44 deletions
diff --git a/curs_main.c b/curs_main.c index 6d066807..34e55b53 100644 --- a/curs_main.c +++ b/curs_main.c @@ -827,48 +827,6 @@ int mutt_index_menu (void) } break; - case OP_MAIN_SYNC_FOLDER: - - CHECK_MSGCOUNT; - CHECK_READONLY; - { - int oldvcount = Context->vcount; - int oldcount = Context->msgcount; - int dcount = 0; - int check; - - /* calculate the number of messages _above_ the cursor, - * so we can keep the cursor on the current message - */ - for (j = 0; j <= menu->current; j++) - { - if (Context->hdrs[Context->v2r[j]]->deleted) - dcount++; - } - - if ((check = mx_sync_mailbox (Context, &index_hint)) == 0) - { - if (Context->vcount != oldvcount) - menu->current -= dcount; - set_option (OPTSEARCHINVALID); - } - else if (check == M_NEW_MAIL || check == M_REOPENED) - update_index (menu, Context, check, oldcount, index_hint); - - /* - * do a sanity check even if mx_sync_mailbox failed. - */ - - if (menu->current < 0 || menu->current >= Context->vcount) - menu->current = ci_first_message (); - } - - /* check for a fatal error, or all messages deleted */ - if (!Context->path) - safe_free ((void **) &Context); - menu->redraw = REDRAW_FULL; - break; - case OP_TAG: CHECK_MSGCOUNT; @@ -918,6 +876,56 @@ int mutt_index_menu (void) * The following operations can be performed inside of the pager. */ + case OP_MAIN_SYNC_FOLDER: + + CHECK_MSGCOUNT; + CHECK_READONLY; + { + int oldvcount = Context->vcount; + int oldcount = Context->msgcount; + int dcount = 0; + int check; + + /* calculate the number of messages _above_ the cursor, + * so we can keep the cursor on the current message + */ + for (j = 0; j <= menu->current; j++) + { + if (Context->hdrs[Context->v2r[j]]->deleted) + dcount++; + } + + if ((check = mx_sync_mailbox (Context, &index_hint)) == 0) + { + if (Context->vcount != oldvcount) + menu->current -= dcount; + set_option (OPTSEARCHINVALID); + } + else if (check == M_NEW_MAIL || check == M_REOPENED) + update_index (menu, Context, check, oldcount, index_hint); + + /* + * do a sanity check even if mx_sync_mailbox failed. + */ + + if (menu->current < 0 || menu->current >= Context->vcount) + menu->current = ci_first_message (); + } + + /* check for a fatal error, or all messages deleted */ + if (!Context->path) + safe_free ((void **) &Context); + + /* if we were in the pager, redisplay the message */ + if (menu->menu == MENU_PAGER) + { + op = OP_DISPLAY_MESSAGE; + continue; + } + else + menu->redraw = REDRAW_FULL; + break; + case OP_MAIN_CHANGE_FOLDER: if (attach_msg) diff --git a/doc/manual.sgml.tail b/doc/manual.sgml.tail index 1e0dbd61..06991ca0 100644 --- a/doc/manual.sgml.tail +++ b/doc/manual.sgml.tail @@ -118,7 +118,7 @@ view-attachments v show MIME attachments <sect2>pager <p> <verb> -bottom $ jump to the bottom of the message +bottom not bound jump to the bottom of the message bounce-message b remail a message to another user change-folder c open a different folder change-folder-readonly ESC c open a different folder in read only mode @@ -181,6 +181,7 @@ search-toggle \ toggle search pattern coloring shell-escape ! invoke a command in a subshell show-version V show the Mutt version number and date skip-quoted S skip beyond quoted text +sync-mailbox $ save changes to mailbox tag-message t tag a message toggle-quoted T toggle display of quoted text top ^ jump to the top of the message diff --git a/functions.h b/functions.h index 3d57238b..3b1bd8ec 100644 --- a/functions.h +++ b/functions.h @@ -200,7 +200,7 @@ struct binding_t OpPager[] = { { "next-page", OP_NEXT_PAGE, " " }, { "previous-page", OP_PREV_PAGE, "-" }, { "top", OP_PAGER_TOP, "^" }, - { "bottom", OP_PAGER_BOTTOM, "$" }, + { "sync-mailbox", OP_MAIN_SYNC_FOLDER, "$" }, { "shell-escape", OP_SHELL_ESCAPE, "!" }, { "enter-command", OP_ENTER_COMMAND, ":" }, { "search", OP_SEARCH, "/" }, @@ -214,6 +214,7 @@ struct binding_t OpPager[] = { { "half-up", OP_HALF_UP, NULL }, { "half-down", OP_HALF_DOWN, NULL }, { "previous-line", OP_PREV_LINE, NULL }, + { "bottom", OP_PAGER_BOTTOM, NULL }, { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" }, |