📄 curs_main.c
字号:
if (tag) menu->redraw |= REDRAW_INDEX; else if (option (OPTRESOLVE)) { if ((menu->current = ci_next_undeleted (menu->current)) == -1) { menu->current = menu->oldcurrent; menu->redraw |= REDRAW_CURRENT; } else menu->redraw |= REDRAW_MOTION_RESYNCH; } else menu->redraw |= REDRAW_CURRENT; } break; case OP_MAIN_COLLAPSE_THREAD: CHECK_MSGCOUNT; CHECK_VISIBLE; if ((Sort & SORT_MASK) != SORT_THREADS) { mutt_error _("Threading is not enabled."); break; } if (CURHDR->collapsed) { menu->current = mutt_uncollapse_thread (Context, CURHDR); mutt_set_virtual (Context); if (option (OPTUNCOLLAPSEJUMP)) menu->current = mutt_thread_next_unread (Context, CURHDR); } else if (option (OPTCOLLAPSEUNREAD) || !UNREAD (CURHDR)) { menu->current = mutt_collapse_thread (Context, CURHDR); mutt_set_virtual (Context); } else { mutt_error _("Thread contains unread messages."); break; } menu->redraw = REDRAW_INDEX | REDRAW_STATUS; break; case OP_MAIN_COLLAPSE_ALL: CHECK_MSGCOUNT; CHECK_VISIBLE; if ((Sort & SORT_MASK) != SORT_THREADS) { mutt_error _("Threading is not enabled."); break; } { HEADER *h, *base; THREAD *thread, *top; int final; if (CURHDR->collapsed) final = mutt_uncollapse_thread (Context, CURHDR); else if (option (OPTCOLLAPSEUNREAD) || !UNREAD (CURHDR)) final = mutt_collapse_thread (Context, CURHDR); else final = CURHDR->virtual; base = Context->hdrs[Context->v2r[final]]; top = Context->tree; Context->collapsed = !Context->collapsed; while ((thread = top) != NULL) { while (!thread->message) thread = thread->child; h = thread->message; if (h->collapsed != Context->collapsed) { if (h->collapsed) mutt_uncollapse_thread (Context, h); else if (option (OPTCOLLAPSEUNREAD) || !UNREAD (h)) mutt_collapse_thread (Context, h); } top = top->next; } mutt_set_virtual (Context); for (j = 0; j < Context->vcount; j++) { if (Context->hdrs[Context->v2r[j]]->index == base->index) { menu->current = j; break; } } menu->redraw = REDRAW_INDEX | REDRAW_STATUS; } break; /* -------------------------------------------------------------------- * These functions are invoked directly from the internal-pager */ case OP_BOUNCE_MESSAGE: CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; ci_bounce_message (tag ? NULL : CURHDR, &menu->redraw); break; case OP_CREATE_ALIAS: mutt_create_alias (Context && Context->vcount ? CURHDR->env : NULL, NULL); MAYBE_REDRAW (menu->redraw); menu->redraw |= REDRAW_CURRENT; break; case OP_QUERY: CHECK_ATTACH; mutt_query_menu (NULL, 0); MAYBE_REDRAW (menu->redraw); break; case OP_DELETE: CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; CHECK_IMAP_ACL(IMAP_ACL_DELETE); if (tag) { mutt_tag_set_flag (M_DELETE, 1); if (option (OPTDELETEUNTAG)) mutt_tag_set_flag (M_TAG, 0); menu->redraw = REDRAW_INDEX; } else { mutt_set_flag (Context, CURHDR, M_DELETE, 1); if (option (OPTDELETEUNTAG)) mutt_set_flag (Context, CURHDR, M_TAG, 0); if (option (OPTRESOLVE)) { if ((menu->current = ci_next_undeleted (menu->current)) == -1) { menu->current = menu->oldcurrent; menu->redraw = REDRAW_CURRENT; } else if (menu->menu == MENU_PAGER) { op = OP_DISPLAY_MESSAGE; continue; } else menu->redraw |= REDRAW_MOTION_RESYNCH; } else menu->redraw = REDRAW_CURRENT; } menu->redraw |= REDRAW_STATUS; break; case OP_DELETE_THREAD: case OP_DELETE_SUBTHREAD: CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; CHECK_IMAP_ACL(IMAP_ACL_DELETE); rc = mutt_thread_set_flag (CURHDR, M_DELETE, 1, op == OP_DELETE_THREAD ? 0 : 1); if (rc != -1) { if (option (OPTDELETEUNTAG)) mutt_thread_set_flag (CURHDR, M_TAG, 0, op == OP_DELETE_THREAD ? 0 : 1); if (option (OPTRESOLVE)) if ((menu->current = ci_next_undeleted (menu->current)) == -1) menu->current = menu->oldcurrent; menu->redraw = REDRAW_INDEX | REDRAW_STATUS; } break; case OP_DISPLAY_ADDRESS: CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_display_address (CURHDR->env); break; case OP_ENTER_COMMAND: CurrentMenu = MENU_MAIN; mutt_enter_command (); mutt_check_rescore (Context); if (option (OPTFORCEREDRAWINDEX)) menu->redraw = REDRAW_FULL; unset_option (OPTFORCEREDRAWINDEX); unset_option (OPTFORCEREDRAWPAGER); break; case OP_EDIT_MESSAGE: CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; CHECK_ATTACH; CHECK_IMAP_ACL(IMAP_ACL_INSERT);#ifdef USE_POP if (Context->magic == M_POP) { mutt_flushinp (); mutt_error _("Can't edit message on POP server."); break; }#endif if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); mutt_edit_message (Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; case OP_FORWARD_MESSAGE: CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_ATTACH; if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); ci_send_message (SENDFORWARD, NULL, NULL, Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; case OP_FORGET_PASSPHRASE: crypt_forget_passphrase (); break; case OP_GROUP_REPLY: CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_ATTACH; if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); ci_send_message (SENDREPLY|SENDGROUPREPLY, NULL, NULL, Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; case OP_LIST_REPLY: CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); ci_send_message (SENDREPLY|SENDLISTREPLY, NULL, NULL, Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; case OP_MAIL: CHECK_ATTACH; ci_send_message (0, NULL, NULL, Context, NULL); menu->redraw = REDRAW_FULL; break; case OP_MAIL_KEY: if (!(WithCrypto & APPLICATION_PGP)) break; CHECK_ATTACH; ci_send_message (SENDKEY, NULL, NULL, NULL, NULL); menu->redraw = REDRAW_FULL; break; case OP_EXTRACT_KEYS: if (!WithCrypto) break; CHECK_MSGCOUNT; CHECK_VISIBLE; crypt_extract_keys_from_messages(tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; case OP_CHECK_TRADITIONAL: if (!(WithCrypto & APPLICATION_PGP)) break; CHECK_MSGCOUNT; CHECK_VISIBLE; if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); if (menu->menu == MENU_PAGER) { op = OP_DISPLAY_MESSAGE; continue; } break; case OP_PIPE: CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_pipe_message (tag ? NULL : CURHDR);#ifdef USE_IMAP /* in an IMAP folder index with imap_peek=no, piping could change * new or old messages status to read. Redraw what's needed. */ if (Context->magic == M_IMAP && !option (OPTIMAPPEEK)) { menu->redraw = (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS; }#endif MAYBE_REDRAW (menu->redraw); break; case OP_PRINT: CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_print_message (tag ? NULL : CURHDR);#ifdef USE_IMAP /* in an IMAP folder index with imap_peek=no, printing could change * new or old messages status to read. Redraw what's needed. */ if (Context->magic == M_IMAP && !option (OPTIMAPPEEK)) { menu->redraw = (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS; }#endif break; case OP_MAIN_READ_THREAD: case OP_MAIN_READ_SUBTHREAD: CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; CHECK_IMAP_ACL(IMAP_ACL_SEEN); rc = mutt_thread_set_flag (CURHDR, M_READ, 1, op == OP_MAIN_READ_THREAD ? 0 : 1); if (rc != -1) { if (option (OPTRESOLVE)) { if ((menu->current = (op == OP_MAIN_READ_THREAD ? mutt_next_thread (CURHDR) : mutt_next_subthread (CURHDR))) == -1) menu->current = menu->oldcurrent; } menu->redraw = REDRAW_INDEX | REDRAW_STATUS; } break; case OP_RECALL_MESSAGE: CHECK_ATTACH; ci_send_message (SENDPOSTPONED, NULL, NULL, Context, NULL); menu->redraw = REDRAW_FULL; break; case OP_RESEND: CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; if (tag) { for (j = 0; j < Context->vcount; j++) { if (Context->hdrs[Context->v2r[j]]->tagged) mutt_resend_message (NULL, Context, Context->hdrs[Context->v2r[j]]); } } else mutt_resend_message (NULL, Context, CURHDR); menu->redraw = REDRAW_FULL; break; case OP_REPLY: CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; if (option (OPTPGPAUTODEC) && (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))) mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw); ci_send_message (SENDREPLY, NULL, NULL, Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; case OP_SHELL_ESCAPE: mutt_shell_escape (); MAYBE_REDRAW (menu->redraw); break; case OP_TAG_THREAD: case OP_TAG_SUBTHREAD: CHECK_MSGCOUNT; CHECK_VISIBLE; rc = mutt_thread_set_flag (CURHDR, M_TAG, !CURHDR->tagged, op == OP_TAG_THREAD ? 0 : 1); if (rc != -1) { if (option (OPTRESOLVE)) { menu->current = mutt_next_thread (CURHDR); if (menu->current == -1) menu->current = menu->oldcurrent; } menu->redraw = REDRAW_INDEX | REDRAW_STATUS; } break; case OP_UNDELETE: CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; CHECK_IMAP_ACL(IMAP_ACL_DELETE); if (tag) { mutt_tag_set_flag (M_DELETE, 0); menu->redraw = REDRAW_INDEX; } else { mutt_set_flag (Context, CURHDR, M_DELETE, 0); if (option (OPTRESOLVE) && menu->current < Context->vcount - 1) { menu->current++; menu->redraw = REDRAW_MOTION_RESYNCH; } else menu->redraw = REDRAW_CURRENT; } menu->redraw |= REDRAW_STATUS; break; case OP_UNDELETE_THREAD: case OP_UNDELETE_SUBTHREAD: CHECK_MSGCOUNT; CHECK_VISIBLE; CHECK_READONLY; CHECK_IMAP_ACL(IMAP_ACL_DELETE); rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0, op == OP_UNDELETE_THREAD ? 0 : 1); if (rc != -1) { if (option (OPTRESOLVE)) { if (op == OP_UNDELETE_THREAD) menu->current = mutt_next_thread (CURHDR); else menu->current = mutt_next_subthread (CURHDR); if (menu->current == -1) menu->current = menu->oldcurrent; } menu->redraw = REDRAW_INDEX | REDRAW_STATUS; } break; case OP_VERSION: mutt_version (); break; case OP_BUFFY_LIST: mutt_buffy_list (); break; case OP_VIEW_ATTACHMENTS: CHECK_MSGCOUNT; CHECK_VISIBLE; mutt_view_attachments (CURHDR); if (CURHDR->attach_del) Context->changed = 1; menu->redraw = REDRAW_FULL; break; case OP_END_COND: break; case OP_WHAT_KEY: mutt_what_key(); break; default: if (menu->menu == MENU_MAIN) km_error_key (MENU_MAIN); } if (menu->menu == MENU_PAGER) { menu->menu = MENU_MAIN; menu->redraw = REDRAW_FULL;#if 0 set_option (OPTWEED); /* turn header weeding back on. */#endif } if (done) break; } mutt_menuDestroy (&menu); return (close);}void mutt_set_header_color (CONTEXT *ctx, HEADER *curhdr){ COLOR_LINE *color; if (!curhdr) return; for (color = ColorIndexList; color; color = color->next) if (mutt_pattern_exec (color->color_pattern, M_MATCH_FULL_ADDRESS, ctx, curhdr)) { curhdr->pair = color->pair; return; } curhdr->pair = ColorDefs[MT_COLOR_NORMAL];}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -