X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=pager.c;h=0e975e430466f3c54b7f1bc91fb62cfd41289fc9;hb=16ff93bd19515d67ea15468b4adb35395970a559;hp=721c0295cdd16b24a0a275129fb6f6aa75dd99e5;hpb=3d937534e7b1ee723f86594b5e4c64c95158a933;p=apps%2Fmadmutt.git diff --git a/pager.c b/pager.c index 721c029..0e975e4 100644 --- a/pager.c +++ b/pager.c @@ -16,6 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include "mutt.h" #include "mutt_curses.h" #include "mutt_regex.h" @@ -971,7 +975,7 @@ fill_buffer (FILE *f, long *last_pos, long offset, unsigned char *buf, unsigned char *fmt, size_t blen, int *buf_ready) { unsigned char *p; - static int b_read; + static int b_read = 0; if (*buf_ready == 0) { @@ -1735,17 +1739,17 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) CLEARLINE_WIN(statusoffset); if (IsHeader (extra)) { - _mutt_make_string (buffer, - COLS-9-SidebarWidth < sizeof (buffer) ? - COLS-9-SidebarWidth : sizeof (buffer), - NONULL (PagerFmt), Context, extra->hdr, M_FORMAT_MAKEPRINT); + size_t l1 = (COLS - 9) * MB_LEN_MAX; + size_t l2 = sizeof (buffer); + _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), + Context, extra->hdr, M_FORMAT_MAKEPRINT); } else if (IsMsgAttach (extra)) { - _mutt_make_string (buffer, - COLS - 9 - SidebarWidth < sizeof (buffer) ? - COLS - 9 - SidebarWidth : sizeof (buffer), - NONULL (PagerFmt), Context, extra->bdy->hdr, M_FORMAT_MAKEPRINT); + size_t l1 = (COLS - 9) * 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); } mutt_paddstr (COLS-10-SidebarWidth, IsHeader (extra) || IsMsgAttach (extra) ? buffer : banner);