📄 pager.c
字号:
} break; case OP_PAGER_BOTTOM: /* move to the end of the file */ if (lineInfo[curline].offset < sb.st_size - 1) { i = curline; /* make sure the types are defined to the end of file */ while (display_line (fp, &last_pos, &lineInfo, i, &lastLine, &maxLine, has_types, &QuoteList, &q_level, &force_redraw, &SearchRE) == 0) i++; topline = upNLines (bodylen, lineInfo, lastLine, hideQuoted); } else mutt_error _("Bottom of message is shown."); break; case OP_REDRAW: clearok (stdscr, TRUE); redraw = REDRAW_FULL; break; case OP_NULL: km_error_key (MENU_PAGER); break; /* -------------------------------------------------------------------- * The following are operations on the current message rather than * adjusting the view of the message. */ case OP_BOUNCE_MESSAGE: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)) CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_bounce (extra->fp, extra->hdr, extra->idx, extra->idxlen, extra->bdy); else ci_bounce_message (extra->hdr, &redraw); break; case OP_RESEND: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)) CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_resend (extra->fp, extra->hdr, extra->idx, extra->idxlen, extra->bdy); else mutt_resend_message (NULL, extra->ctx, extra->hdr); redraw = REDRAW_FULL; break; case OP_CHECK_TRADITIONAL: CHECK_MODE (IsHeader (extra)); if (!(WithCrypto & APPLICATION_PGP)) break; if (!(extra->hdr->security & PGP_TRADITIONAL_CHECKED)) { ch = -1; rc = OP_CHECK_TRADITIONAL; } break; case OP_CREATE_ALIAS: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); if (IsMsgAttach (extra)) mutt_create_alias (extra->bdy->hdr->env, NULL); else mutt_create_alias (extra->hdr->env, NULL); MAYBE_REDRAW (redraw); break; case OP_DELETE: CHECK_MODE(IsHeader (extra)); CHECK_READONLY;#ifdef USE_IMAPCHECK_IMAP_ACL(IMAP_ACL_DELETE);#endif mutt_set_flag (Context, extra->hdr, M_DELETE, 1); if (option (OPTDELETEUNTAG)) mutt_set_flag (Context, extra->hdr, M_TAG, 0); redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; rc = OP_MAIN_NEXT_UNDELETED; } break; case OP_DELETE_THREAD: case OP_DELETE_SUBTHREAD: CHECK_MODE(IsHeader (extra)); CHECK_READONLY;#ifdef USE_IMAPCHECK_IMAP_ACL(IMAP_ACL_DELETE);#endif r = mutt_thread_set_flag (extra->hdr, M_DELETE, 1, ch == OP_DELETE_THREAD ? 0 : 1); if (r != -1) { if (option (OPTDELETEUNTAG)) mutt_thread_set_flag (extra->hdr, M_TAG, 0, ch == OP_DELETE_THREAD ? 0 : 1); if (option (OPTRESOLVE)) { rc = OP_MAIN_NEXT_UNDELETED; ch = -1; } if (!option (OPTRESOLVE) && PagerIndexLines) redraw = REDRAW_FULL; else redraw = REDRAW_STATUS | REDRAW_INDEX; } break; case OP_DISPLAY_ADDRESS: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); if (IsMsgAttach (extra)) mutt_display_address (extra->bdy->hdr->env); else mutt_display_address (extra->hdr->env); break; case OP_ENTER_COMMAND: old_smart_wrap = option (OPTWRAP); old_markers = option (OPTMARKERS); old_PagerIndexLines = PagerIndexLines; CurrentMenu = MENU_PAGER; mutt_enter_command (); if (option (OPTNEEDRESORT)) { unset_option (OPTNEEDRESORT); CHECK_MODE(IsHeader (extra)); set_option (OPTNEEDRESORT); } if (old_PagerIndexLines != PagerIndexLines) { if (index) mutt_menuDestroy (&index); index = NULL; } if (option (OPTWRAP) != old_smart_wrap || option (OPTMARKERS) != old_markers) { if (flags & M_PAGER_RETWINCH) { ch = -1; rc = OP_REFORMAT_WINCH; continue; } /* count the real lines above */ j = 0; for (i = 0; i <= topline; i++) { if (!lineInfo[i].continuation) j++; } /* we need to restart the whole thing */ for (i = 0; i < maxLine; i++) { lineInfo[i].offset = 0; lineInfo[i].type = -1; lineInfo[i].continuation = 0; lineInfo[i].chunks = 0; lineInfo[i].search_cnt = -1; lineInfo[i].quote = NULL; safe_realloc (&(lineInfo[i].syntax), sizeof (struct syntax_t)); if (SearchCompiled && lineInfo[i].search) FREE (&(lineInfo[i].search)); } if (SearchCompiled) { regfree (&SearchRE); SearchCompiled = 0; } SearchFlag = 0; /* try to keep the old position */ topline = 0; lastLine = 0; while (j > 0 && display_line (fp, &last_pos, &lineInfo, topline, &lastLine, &maxLine, (has_types ? M_TYPES : 0), &QuoteList, &q_level, &force_redraw, &SearchRE) == 0) { if (! lineInfo[topline].continuation) j--; if (j > 0) topline++; } ch = 0; } if (option (OPTFORCEREDRAWPAGER)) redraw = REDRAW_FULL; unset_option (OPTFORCEREDRAWINDEX); unset_option (OPTFORCEREDRAWPAGER); break; case OP_FLAG_MESSAGE: CHECK_MODE(IsHeader (extra)); CHECK_READONLY;#ifdef USE_POP if (Context->magic == M_POP) { mutt_flushinp (); mutt_error _("Can't change 'important' flag on POP server."); break; }#endif#ifdef USE_IMAPCHECK_IMAP_ACL(IMAP_ACL_WRITE);#endif mutt_set_flag (Context, extra->hdr, M_FLAG, !extra->hdr->flagged); redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; rc = OP_MAIN_NEXT_UNDELETED; } break; case OP_PIPE: CHECK_MODE(IsHeader (extra) || IsAttach (extra)); if (IsAttach (extra)) mutt_pipe_attachment_list (extra->fp, 0, extra->bdy, 0); else mutt_pipe_message (extra->hdr); MAYBE_REDRAW (redraw); break; case OP_PRINT: CHECK_MODE(IsHeader (extra) || IsAttach (extra)); if (IsAttach (extra)) mutt_print_attachment_list (extra->fp, 0, extra->bdy); else mutt_print_message (extra->hdr); break; case OP_MAIL: CHECK_MODE(IsHeader (extra) && !IsAttach (extra)); CHECK_ATTACH; ci_send_message (0, NULL, NULL, extra->ctx, NULL); redraw = REDRAW_FULL; break; case OP_REPLY: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_reply (extra->fp, extra->hdr, extra->idx, extra->idxlen, extra->bdy, SENDREPLY); else ci_send_message (SENDREPLY, NULL, NULL, extra->ctx, extra->hdr); redraw = REDRAW_FULL; break; case OP_RECALL_MESSAGE: CHECK_MODE(IsHeader (extra) && !IsAttach(extra)); CHECK_ATTACH; ci_send_message (SENDPOSTPONED, NULL, NULL, extra->ctx, extra->hdr); redraw = REDRAW_FULL; break; case OP_GROUP_REPLY: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_reply (extra->fp, extra->hdr, extra->idx, extra->idxlen, extra->bdy, SENDREPLY|SENDGROUPREPLY); else ci_send_message (SENDREPLY | SENDGROUPREPLY, NULL, NULL, extra->ctx, extra->hdr); redraw = REDRAW_FULL; break; case OP_LIST_REPLY: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_reply (extra->fp, extra->hdr, extra->idx, extra->idxlen, extra->bdy, SENDREPLY|SENDLISTREPLY); else ci_send_message (SENDREPLY | SENDLISTREPLY, NULL, NULL, extra->ctx, extra->hdr); redraw = REDRAW_FULL; break; case OP_FORWARD_MESSAGE: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_forward (extra->fp, extra->hdr, extra->idx, extra->idxlen, extra->bdy); else ci_send_message (SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr); redraw = REDRAW_FULL; break; case OP_DECRYPT_SAVE: if (!WithCrypto) { ch = -1; break; } /* fall through */ case OP_SAVE: if (IsAttach (extra)) { mutt_save_attachment_list (extra->fp, 0, extra->bdy, extra->hdr, NULL); break; } /* fall through */ case OP_COPY_MESSAGE: case OP_DECODE_SAVE: case OP_DECODE_COPY: case OP_DECRYPT_COPY: if (!WithCrypto && ch == OP_DECRYPT_COPY) { ch = -1; break; } CHECK_MODE(IsHeader (extra)); if (mutt_save_message (extra->hdr, (ch == OP_DECRYPT_SAVE) || (ch == OP_SAVE) || (ch == OP_DECODE_SAVE), (ch == OP_DECODE_SAVE) || (ch == OP_DECODE_COPY), (ch == OP_DECRYPT_SAVE) || (ch == OP_DECRYPT_COPY) || 0, &redraw) == 0 && (ch == OP_SAVE || ch == OP_DECODE_SAVE || ch == OP_DECRYPT_SAVE )) { if (option (OPTRESOLVE)) { ch = -1; rc = OP_MAIN_NEXT_UNDELETED; } else redraw |= REDRAW_STATUS | REDRAW_INDEX; } MAYBE_REDRAW (redraw); break; case OP_SHELL_ESCAPE: mutt_shell_escape (); MAYBE_REDRAW (redraw); break; case OP_TAG: CHECK_MODE(IsHeader (extra)); mutt_set_flag (Context, extra->hdr, M_TAG, !extra->hdr->tagged); Context->last_tag = extra->hdr->tagged ? extra->hdr : ((Context->last_tag == extra->hdr && !extra->hdr->tagged) ? NULL : Context->last_tag); redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; rc = OP_NEXT_ENTRY; } break; case OP_TOGGLE_NEW: CHECK_MODE(IsHeader (extra)); CHECK_READONLY;#ifdef USE_IMAPCHECK_IMAP_ACL(IMAP_ACL_SEEN);#endif if (extra->hdr->read || extra->hdr->old) mutt_set_flag (Context, extra->hdr, M_NEW, 1); else if (!first) mutt_set_flag (Context, extra->hdr, M_READ, 1); first = 0; Context->msgnotreadyet = -1; redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; rc = OP_MAIN_NEXT_UNDELETED; } break; case OP_UNDELETE: CHECK_MODE(IsHeader (extra)); CHECK_READONLY;#ifdef USE_IMAPCHECK_IMAP_ACL(IMAP_ACL_DELETE);#endif mutt_set_flag (Context, extra->hdr, M_DELETE, 0); redraw = REDRAW_STATUS | REDRAW_INDEX; if (option (OPTRESOLVE)) { ch = -1; rc = OP_NEXT_ENTRY; } break; case OP_UNDELETE_THREAD: case OP_UNDELETE_SUBTHREAD: CHECK_MODE(IsHeader (extra)); CHECK_READONLY;#ifdef USE_IMAPCHECK_IMAP_ACL(IMAP_ACL_DELETE);#endif r = mutt_thread_set_flag (extra->hdr, M_DELETE, 0, ch == OP_UNDELETE_THREAD ? 0 : 1); if (r != -1) { if (option (OPTRESOLVE)) { rc = (ch == OP_DELETE_THREAD) ? OP_MAIN_NEXT_THREAD : OP_MAIN_NEXT_SUBTHREAD; ch = -1; } if (!option (OPTRESOLVE) && PagerIndexLines) redraw = REDRAW_FULL; else redraw = REDRAW_STATUS | REDRAW_INDEX; } break; case OP_VERSION: mutt_version (); break; case OP_BUFFY_LIST: mutt_buffy_list (); break; case OP_VIEW_ATTACHMENTS: if (flags & M_PAGER_ATTACHMENT) { ch = -1; rc = OP_ATTACH_COLLAPSE; break; } CHECK_MODE(IsHeader (extra)); mutt_view_attachments (extra->hdr); if (extra->hdr->attach_del) Context->changed = 1; redraw = REDRAW_FULL; break; case OP_MAIL_KEY: if (!(WithCrypto & APPLICATION_PGP)) { ch = -1; break; } CHECK_MODE(IsHeader(extra)); CHECK_ATTACH; ci_send_message (SENDKEY, NULL, NULL, extra->ctx, extra->hdr); redraw = REDRAW_FULL; break; case OP_FORGET_PASSPHRASE: crypt_forget_passphrase (); break; case OP_EXTRACT_KEYS: if (!WithCrypto) { ch = -1; break; } CHECK_MODE(IsHeader(extra)); crypt_extract_keys_from_messages(extra->hdr); redraw = REDRAW_FULL; break; default: ch = -1; break; } } fclose (fp); if (IsHeader (extra)) { Context->msgnotreadyet = -1; if (rc == -1) OldHdr = NULL; else { TopLine = topline; OldHdr = extra->hdr; } } cleanup_quote (&QuoteList); for (i = 0; i < maxLine ; i++) { FREE (&(lineInfo[i].syntax)); if (SearchCompiled && lineInfo[i].search) FREE (&(lineInfo[i].search)); } if (SearchCompiled) { regfree (&SearchRE); SearchCompiled = 0; } FREE (&lineInfo); if (index) mutt_menuDestroy(&index); return (rc != -1 ? rc : 0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -