From: Pierre Habouzit Date: Mon, 9 Apr 2007 22:58:55 +0000 (+0200) Subject: drop !builtin pager, sucks badly, and I plan to improve the pager anyways. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=ace94418088f9165d23763bd39752cc31b406f03;p=apps%2Fmadmutt.git drop !builtin pager, sucks badly, and I plan to improve the pager anyways. Signed-off-by: Pierre Habouzit --- diff --git a/attach.c b/attach.c index 1750e26..53fac9e 100644 --- a/attach.c +++ b/attach.c @@ -533,19 +533,10 @@ int mutt_view_attachment (FILE * fp, BODY * a, int flag, HEADER * hdr, /* We only reach this point if there have been no errors */ if (use_pager) { - pager_t info; - p_clear(&info, 1); - - info.fp = fp; - info.bdy = a; - info.ctx = Context; - info.idx = idx; - info.idxlen = idxlen; - info.hdr = hdr; - - rc = mutt_do_pager(descrip, pagerfile, - M_PAGER_ATTACHMENT | (is_message ? M_PAGER_MESSAGE : 0), - &info); + pager_t info = { Context, hdr, a, fp, idx, idxlen }; + rc = mutt_pager(descrip, pagerfile, + M_PAGER_ATTACHMENT | (is_message ? M_PAGER_MESSAGE : 0), + &info); *pagerfile = '\0'; } else diff --git a/commands.c b/commands.c index cf56023..da633cb 100644 --- a/commands.c +++ b/commands.c @@ -42,7 +42,6 @@ static char LastSaveFolder[_POSIX_PATH_MAX] = ""; int mutt_display_message (HEADER * cur) { char tempfile[_POSIX_PATH_MAX], buf[LONG_STRING]; - int rc = 0, builtin = 0; int cmflags = M_CM_DECODE | M_CM_DISPLAY | M_CM_CHARCONV; FILE *fpout = NULL; FILE *fpfilterout = NULL; @@ -76,14 +75,6 @@ int mutt_display_message (HEADER * cur) } } - if (!Pager || m_strcmp(Pager, "builtin") == 0) - builtin = 1; - else { - mutt_make_string (buf, sizeof (buf), NONULL (PagerFmt), Context, cur); - fputs (buf, fpout); - fputs ("\n\n", fpout); - } - msg = mx_open_message (Context, cur->msgno); if (msg == NULL) res = -1; @@ -138,59 +129,38 @@ int mutt_display_message (HEADER * cur) are color patterns for both ~g and ~V */ cur->pair = 0; - if (builtin) { - pager_t info; - - if ((cur->security & APPLICATION_SMIME) && (cmflags & M_CM_VERIFY)) { - if (cur->security & GOODSIGN) { - if (!crypt_smime_verify_sender (cur)) - mutt_message (_("S/MIME signature successfully verified.")); - else - mutt_error (_("S/MIME certificate owner does not match sender.")); - } - else if (cur->security & PARTSIGN) - mutt_message (_ - ("Warning: Part of this message has not been signed.")); - else if (cur->security & SIGN || cur->security & BADSIGN) - mutt_error (_("S/MIME signature could NOT be verified.")); + if ((cur->security & APPLICATION_SMIME) && (cmflags & M_CM_VERIFY)) { + if (cur->security & GOODSIGN) { + if (!crypt_smime_verify_sender (cur)) + mutt_message (_("S/MIME signature successfully verified.")); + else + mutt_error (_("S/MIME certificate owner does not match sender.")); } + else if (cur->security & PARTSIGN) + mutt_message (_ + ("Warning: Part of this message has not been signed.")); + else if (cur->security & SIGN || cur->security & BADSIGN) + mutt_error (_("S/MIME signature could NOT be verified.")); + } - if ((cur->security & APPLICATION_PGP) && (cmflags & M_CM_VERIFY)) { - if (cur->security & GOODSIGN) - mutt_message (_("PGP signature successfully verified.")); - else if (cur->security & PARTSIGN) - mutt_message (_ - ("Warning: Part of this message has not been signed.")); - else if (cur->security & SIGN) - mutt_message (_("PGP signature could NOT be verified.")); - } + if ((cur->security & APPLICATION_PGP) && (cmflags & M_CM_VERIFY)) { + if (cur->security & GOODSIGN) + mutt_message (_("PGP signature successfully verified.")); + else if (cur->security & PARTSIGN) + mutt_message (_ + ("Warning: Part of this message has not been signed.")); + else if (cur->security & SIGN) + mutt_message (_("PGP signature could NOT be verified.")); + } + + { + pager_t info; - /* Invoke the builtin pager */ p_clear(&info, 1); info.hdr = cur; info.ctx = Context; - rc = mutt_pager (NULL, tempfile, M_PAGER_MESSAGE, &info); - } - else { - int r; - - mutt_endwin (NULL); - snprintf (buf, sizeof (buf), "%s %s", NONULL (Pager), tempfile); - if ((r = mutt_system (buf)) == -1) - mutt_error (_("Error running \"%s\"!"), buf); - unlink (tempfile); - keypad (stdscr, TRUE); - if (r != -1) - mutt_set_flag (Context, cur, M_READ, 1); - if (r != -1 && option (OPTPROMPTAFTER)) { - mutt_ungetch (mutt_any_key_to_continue _("Command: "), 0); - rc = km_dokey (MENU_PAGER); - } - else - rc = 0; + return mutt_pager (NULL, tempfile, M_PAGER_MESSAGE, &info); } - - return rc; } void ci_bounce_message (HEADER * h, int *redraw) diff --git a/crypt.c b/crypt.c index 7a10ff1..b9a5122 100644 --- a/crypt.c +++ b/crypt.c @@ -2807,7 +2807,7 @@ leave: m_fclose(&fp); mutt_clear_error (); snprintf (cmd, sizeof (cmd), _("Key ID: 0x%s"), crypt_keyid (key)); - mutt_do_pager (cmd, tempfile, 0, NULL); + mutt_pager(cmd, tempfile, 0, NULL); } /* Implementation of `findkeys'. */ diff --git a/globals.h b/globals.h index a64a997..227a9dc 100644 --- a/globals.h +++ b/globals.h @@ -83,7 +83,6 @@ WHERE char *NntpUser; WHERE char *NntpPass; WHERE char *NewsRc; #endif -WHERE char *Pager; WHERE char *PagerFmt; WHERE char *PipeSep; diff --git a/help.c b/help.c index 062f975..d5182ca 100644 --- a/help.c +++ b/help.c @@ -164,9 +164,7 @@ static void format_line (FILE * f, int ismacro, } if (ismacro > 0) { - if (!m_strcmp(Pager, "builtin")) - fputs ("_\010", f); - fputs ("M ", f); + fputs ("_\010M ", f); col += 2; if (!split) { @@ -205,15 +203,9 @@ static void format_line (FILE * f, int ismacro, print_macro (f, n, &t3); if (*t3) { - if (m_strcmp(Pager, "builtin")) { - fputc ('\n', f); - n = 0; - } - else { - n += col - COLS; - if (option (OPTMARKERS)) - ++n; - } + n += col - COLS; + if (option (OPTMARKERS)) + ++n; col = pad (f, n, col_b); } } @@ -306,7 +298,7 @@ void mutt_help (int menu) m_fclose(&f); snprintf(buf, sizeof (buf), _("Help for %s"), desc); - } while (mutt_do_pager(buf, tmp, - M_PAGER_RETWINCH | M_PAGER_MARKER | M_PAGER_NSKIP, - NULL) == OP_REFORMAT_WINCH); + } while (mutt_pager(buf, tmp, + M_PAGER_RETWINCH | M_PAGER_MARKER | M_PAGER_NSKIP, + NULL) == OP_REFORMAT_WINCH); } diff --git a/init.h b/init.h index 1dac55d..c53eb49 100644 --- a/init.h +++ b/init.h @@ -1509,19 +1509,6 @@ struct option_t MuttVars[] = { ** .pp ** See also ``$$read_inc'' and ``$$write_inc''. */ - {"pager", DT_PATH, R_NONE, UL &Pager, "builtin"}, - /* - ** .pp - ** This variable specifies which pager you would like to use to view - ** messages. ``builtin'' means to use the builtin pager, otherwise this - ** variable should specify the pathname of the external pager you would - ** like to use. - ** .pp - ** Using an external pager may have some disadvantages: Additional - ** keystrokes are necessary because you can't call Madmutt functions - ** directly from the pager, and screen resizes cause lines longer than - ** the screen width to be badly formatted in the help menu. - */ {"pager_context", DT_NUM, R_NONE, UL &PagerContext, "0" }, /* ** .pp diff --git a/lib-ui/curs_lib.c b/lib-ui/curs_lib.c index 66ffbb4..7562ad8 100644 --- a/lib-ui/curs_lib.c +++ b/lib-ui/curs_lib.c @@ -390,30 +390,6 @@ int mutt_any_key_to_continue (const char *s) return (ch); } -int mutt_do_pager (const char *banner, - const char *tempfile, int do_color, pager_t * info) -{ - int rc; - - if (!Pager || m_strcmp(Pager, "builtin") == 0) - rc = mutt_pager (banner, tempfile, do_color, info); - else { - char cmd[STRING]; - - mutt_endwin (NULL); - m_quotefile_fmt(cmd, sizeof (cmd), Pager, tempfile); - if (mutt_system (cmd) == -1) { - mutt_error (_("Error running \"%s\"!"), cmd); - rc = -1; - } - else - rc = 0; - mutt_unlink (tempfile); - } - - return rc; -} - int _mutt_enter_fname (const char *prompt, char *buf, ssize_t blen, int *redraw, int buffy, int multiple, char ***files, int *numfiles) diff --git a/mutt_sasl.c b/mutt_sasl.c index e32af34..dd97bfa 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -434,9 +434,9 @@ mutt_sasl_conn_write(CONNECTION * conn, const char *buf, ssize_t len) goto fail; } - rc = (sasldata->msasl_write)(conn, pbuf, plen); + plen -= (sasldata->msasl_write)(conn, pbuf, plen); p_delete(&pbuf); - if (rc != plen) + if (plen) goto fail; len -= olen; diff --git a/pager.h b/pager.h index 7520620..bf4bf0a 100644 --- a/pager.h +++ b/pager.h @@ -37,7 +37,6 @@ typedef struct { short idxlen; } pager_t; -int mutt_do_pager (const char *, const char *, int, pager_t *); -int mutt_pager (const char *, const char *, int, pager_t *); +int mutt_pager(const char *, const char *, int, pager_t *); #endif /* !_MUTT_PAGER_H */ diff --git a/sendlib.c b/sendlib.c index 328aa2b..86440df 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1907,8 +1907,7 @@ static int mutt_invoke_sendmail (address_t * from, /* the sender */ struct stat st; if (!stat(childout, &st) && st.st_size > 0) - mutt_do_pager(_("Output of the delivery process"), childout, 0, - NULL); + mutt_pager(_("Output of the delivery process"), childout, 0, NULL); } } } else { diff --git a/state.c b/state.c index 4e74a7e..f21db7e 100644 --- a/state.c +++ b/state.c @@ -119,7 +119,7 @@ int state_printf (STATE * s, const char *fmt, ...) void state_mark_attach (STATE * s) { - if ((s->flags & M_DISPLAY) && !m_strcmp(Pager, "builtin")) + if (s->flags & M_DISPLAY) state_puts (AttachmentMarker, s); }