Append "%> -- (%P)" to $pager_status to emulate old behavior.
Closes #2087.
* %n = name of author
* %N = score
* %O = like %L, except using address instead of name
+ * %P = progress indicator for builtin pager
* %s = subject
* %S = short message status (e.g., N/O/D/!/r/-)
* %t = `to:' field (recipients)
* %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label)
* %Z = status flags */
-struct hdr_format_info
-{
- CONTEXT *ctx;
- HEADER *hdr;
-};
-
static const char *
hdr_format_str (char *dest,
size_t destlen,
}
break;
+ case 'P':
+ strfcpy(dest, NONULL(hfi->pager_progress), destlen);
+ break;
+
case 's':
if (flags & M_FORMAT_TREE && !hdr->collapsed)
hfi.hdr = hdr;
hfi.ctx = ctx;
+ hfi.pager_progress = 0;
mutt_FormatString (dest, destlen, 0, s, hdr_format_str, (unsigned long) &hfi, flags);
}
+
+void
+mutt_make_string_info (char *dst, size_t dstlen, const char *s, struct hdr_format_info *hfi, format_flag flags)
+{
+ mutt_FormatString (dst, dstlen, 0, s, hdr_format_str, (unsigned long) hfi, flags);
+}
** .dt %n .dd author's real name (or address if missing)
** .dt %O .dd (_O_riginal save folder) Where mutt would formerly have
** stashed the message: list name or recipient name if no list
+ ** .dt %P .dd progress indicator for the builtin pager (how much of the file has been displayed)
** .dt %s .dd subject of the message
** .dt %S .dd status of the message (N/D/d/!/r/\(as)
** .dt %t .dd `to:' field (recipients)
** default, Mutt will display the line after the last one on the screen
** at the top of the next page (0 lines of context).
*/
- { "pager_format", DT_STR, R_PAGER, UL &PagerFmt, UL "-%Z- %C/%m: %-20.20n %s" },
+ { "pager_format", DT_STR, R_PAGER, UL &PagerFmt, UL "-%Z- %C/%m: %-20.20n %s%> -- (%P)" },
/*
** .pp
** This variable controls the format of the one-line message ``status''
if (redraw & REDRAW_STATUS)
{
+ struct hdr_format_info hfi;
+ char pager_progress_str[4];
+
+ hfi.ctx = Context;
+ hfi.pager_progress = pager_progress_str;
+
+ if (last_pos < sb.st_size - 1)
+ snprintf(pager_progress_str, sizeof(pager_progress_str), "%lld%%", (100 * last_offset / sb.st_size));
+ else
+ strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str));
+
/* print out the pager status bar */
SETCOLOR (MT_COLOR_STATUS);
BKGDSET (MT_COLOR_STATUS);
CLEARLINE (statusoffset);
if (IsHeader (extra))
{
- size_t l1 = (COLS - 9) * MB_LEN_MAX;
+ size_t l1 = COLS * MB_LEN_MAX;
size_t l2 = sizeof (buffer);
- _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
- Context, extra->hdr, M_FORMAT_MAKEPRINT);
+ hfi.hdr = extra->hdr;
+ mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
}
else if (IsMsgAttach (extra))
{
- size_t l1 = (COLS - 9) * MB_LEN_MAX;
+ size_t l1 = COLS * MB_LEN_MAX;
size_t l2 = sizeof (buffer);
- _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
- Context, extra->bdy->hdr, M_FORMAT_MAKEPRINT);
+ hfi.hdr = extra->bdy->hdr;
+ mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
}
- mutt_paddstr (COLS-10, IsHeader (extra) || IsMsgAttach (extra) ?
- buffer : banner);
- addstr (" -- (");
- if (last_pos < sb.st_size - 1)
- printw ("%d%%)", (int) (100 * last_offset / sb.st_size));
- else
- addstr (topline == 0 ? "all)" : "end)");
+ mutt_paddstr (COLS, IsHeader (extra) || IsMsgAttach (extra) ? buffer : banner);
BKGDSET (MT_COLOR_NORMAL);
SETCOLOR (MT_COLOR_NORMAL);
}
void _mutt_make_string (char *, size_t, const char *, CONTEXT *,
HEADER *, format_flag);
+struct hdr_format_info
+{
+ CONTEXT *ctx;
+ HEADER *hdr;
+ const char *pager_progress;
+};
+
+void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
+
int mutt_extract_token (BUFFER *, BUFFER *, int);
BUFFER * mutt_buffer_init (BUFFER *);
BUFFER * mutt_buffer_from (BUFFER *, char *);