Commit 4e7bcaa0 authored by Thomas Roessler's avatar Thomas Roessler

Make folder synchronization possible from within the pager. From

Chris Cutler <cutler@bluemug.com>.
parent d83c672d
......@@ -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)
......
......@@ -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
......
......@@ -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" },
......
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