++ { "sidebar-next", OP_SIDEBAR_NEXT, NULL },
++ { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
++ { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
+ { NULL, 0, NULL }
+ };
+
+***************
+*** 272,277 ****
+--- 277,287 ----
+
+ { "what-key", OP_WHAT_KEY, NULL },
+
++ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL },
++ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL },
++ { "sidebar-next", OP_SIDEBAR_NEXT, NULL },
++ { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
++ { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
+ { NULL, 0, NULL }
+ };
+
+*** mutt-1.5.23-orig/globals.h 2014-03-12 11:06:17.000000000 -0500
+--- mutt-1.5.23/globals.h 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 117,122 ****
+--- 117,125 ----
+ WHERE char *SendCharset;
+ WHERE char *Sendmail;
+ WHERE char *Shell;
++ WHERE char *SidebarDelim;
++ WHERE char *SidebarFormat;
++ WHERE char *SidebarIndentStr;
+ WHERE char *Signature;
+ WHERE char *SimpleSearch;
+ #if USE_SMTP
+***************
+*** 208,213 ****
+--- 211,219 ----
+ WHERE short ScoreThresholdRead;
+ WHERE short ScoreThresholdFlag;
+
++ WHERE struct buffy_t *CurBuffy INITVAL(0);
++ WHERE short DrawFullLine INITVAL(0);
++ WHERE short SidebarWidth;
+ #ifdef USE_IMAP
+ WHERE short ImapKeepalive;
+ WHERE short ImapPipelineDepth;
+*** mutt-1.5.23-orig/handler.c 2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/handler.c 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 1599,1604 ****
+--- 1599,1609 ----
+ size_t tmplength = 0;
+ int rc = 0;
+
++ #ifdef HAVE_FMEMOPEN
++ char *temp;
++ size_t tempsize;
++ #endif
++
+ int oflags = s->flags;
+
+ /* first determine which handler to use to process this part */
+***************
+*** 1711,1716 ****
+--- 1716,1729 ----
+ {
+ /* decode to a tempfile, saving the original destination */
+ fp = s->fpout;
++ #ifdef HAVE_FMEMOPEN
++ if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
++ {
++ mutt_error _("Unable to open memory stream!");
++ dprint (1, (debugfile, "Can't open memory stream.\n"));
++ goto bail;
++ }
++ #else
+ mutt_mktemp (tempfile, sizeof (tempfile));
+ if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
+ {
+***************
+*** 1718,1723 ****
+--- 1731,1737 ----
+ dprint (1, (debugfile, "Can't open %s.\n", tempfile));
+ goto bail;
+ }
++ #endif
+ /* decoding the attachment changes the size and offset, so save a copy
+ * of the "real" values now, and restore them after processing
+ */
+***************
+*** 1746,1753 ****
+--- 1760,1778 ----
+ /* restore final destination and substitute the tempfile for input */
+ s->fpout = fp;
+ fp = s->fpin;
++ #ifdef HAVE_FMEMOPEN
++ if(tempsize)
++ s->fpin = fmemopen(temp, tempsize, "r");
++ else /* fmemopen cannot handle zero-length buffers */
++ s->fpin = safe_fopen ("/dev/null", "r");
++ if(s->fpin == NULL) {
++ mutt_perror("failed to re-open memstream!");
++ return (-1);
++ }
++ #else
+ s->fpin = fopen (tempfile, "r");
+ unlink (tempfile);
++ #endif
+
+ /* restore the prefix */
+ s->prefix = savePrefix;
+***************
+*** 1773,1778 ****
+--- 1798,1807 ----
+
+ /* restore the original source stream */
+ safe_fclose (&s->fpin);
++ #ifdef HAVE_FMEMOPEN
++ if(tempsize)
++ FREE(&temp);
++ #endif
+ s->fpin = fp;
+ }
+ }
+*** mutt-1.5.23-orig/init.h 2014-03-12 11:06:17.000000000 -0500
+--- mutt-1.5.23/init.h 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 1966,1971 ****
+--- 1966,2019 ----
+ ** not used.
+ ** (PGP only)
+ */
++ {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, UL "|"},
++ /*
++ ** .pp
++ ** This specifies the delimiter between the sidebar (if visible) and
++ ** other screens.
++ */
++ {"sidebar_indentstr", DT_STR, R_BOTH, UL &SidebarIndentStr, UL " "},
++ /*
++ ** .pp
++ ** This specifies the string that is used to indent items
++ ** with sidebar_folderindent= yes
++ */
++ { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 },
++ /*
++ ** .pp
++ ** This specifies whether or not to show sidebar (left-side list of folders).
++ */
++ { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 },
++ /*
++ ** .pp
++ ** This specifies whether or not to sort the sidebar alphabetically.
++ */
++ { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 },
++ /*
++ ** .pp
++ ** The width of the sidebar.
++ */
++ { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
++ /*
++ ** .pp
++ ** Should the sidebar shorten the path showed.
++ */
++ {"sidebar_format", DT_STR, R_NONE, UL &SidebarFormat, UL "%B%?F? [%F]?%* %?N?%N/?%4S"},
++ /*
++ ** .pp
++ ** Format string for the sidebar. The sequences `%N', `%F' and `%S'
++ ** will be replaced by the number of new or flagged messages or the total
++ ** size of them mailbox. `%B' will be replaced with the name of the mailbox.
++ ** The `%!' sequence will be expanded to `!' if there is one flagged message;
++ ** to `!!' if there are two flagged messages; and to `n!' for n flagged
++ ** messages, n>2.
++ */
++ { "sidebar_folderindent", DT_BOOL, R_BOTH, OPTSIDEBARFOLDERINDENT, 0 },
++ /*
++ ** .pp
++ ** Should folders be indented in the sidebar.
++ */
++
+ { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
+ /*
+ ** .pp
+*** mutt-1.5.23-orig/mailbox.h 2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/mailbox.h 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 27,32 ****
+--- 27,33 ----
+ #define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses
+ * safe_fopen() for mbox-style folders.
+ */
++ #define M_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */
+
+ /* mx_open_new_message() */
+ #define M_ADD_FROM 1 /* add a From_ line */
+*** mutt-1.5.23-orig/main.c 2014-03-12 11:06:17.000000000 -0500
+--- mutt-1.5.23/main.c 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 50,55 ****
+--- 50,56 ----
+ #include <unistd.h>
+ #include <errno.h>
+ #include <sys/stat.h>
++ #include <limits.h>
+ #include <sys/utsname.h>
+
+ #ifdef HAVE_GETOPT_H
+***************
+*** 555,561 ****
+
+ int main (int argc, char **argv)
+ {
+! char folder[_POSIX_PATH_MAX] = "";
+ char *subject = NULL;
+ char *includeFile = NULL;
+ char *draftFile = NULL;
+--- 556,562 ----
+
+ int main (int argc, char **argv)
+ {
+! char folder[PATH_MAX] = "";
+ char *subject = NULL;
+ char *includeFile = NULL;
+ char *draftFile = NULL;
+***************
+*** 1025,1030 ****
+--- 1026,1038 ----
+ strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
+ mutt_expand_path (folder, sizeof (folder));
+
++ {
++ char tmpfolder[PATH_MAX];
++ strfcpy (tmpfolder, folder, sizeof (tmpfolder));
++ if(!realpath(tmpfolder, folder))
++ strfcpy (folder, tmpfolder, sizeof (tmpfolder));
++ }
++
+ mutt_str_replace (&CurrentFolder, folder);
+ mutt_str_replace (&LastFolder, folder);
+
+***************
+*** 1047,1052 ****
+--- 1055,1061 ----
+ if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
+ || !explicit_folder)
+ {
++ set_curbuffy(folder);
+ mutt_index_menu ();
+ if (Context)
+ FREE (&Context);
+*** mutt-1.5.23-orig/Makefile.am 2014-03-12 11:03:44.000000000 -0500
+--- mutt-1.5.23/Makefile.am 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 32,37 ****
+--- 32,38 ----
+ rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
+ score.c send.c sendlib.c signal.c sort.c \
+ status.c system.c thread.c charset.c history.c lib.c \
++ sidebar.c \
+ muttlib.c editmsg.c mbyte.c \
+ url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
+
+*** mutt-1.5.23-orig/Makefile.in 2014-03-12 11:26:44.000000000 -0500
+--- mutt-1.5.23/Makefile.in 2014-04-12 12:12:38.000000000 -0500
+***************
+*** 129,135 ****
+ system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
+ history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
+ editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
+! ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
+ am__objects_1 =
+ am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
+ $(am__objects_1)
+--- 129,136 ----
+ system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
+ history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
+ editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
+! ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) \
+! sidebar.$(OBJEXT)
+ am__objects_1 =
+ am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
+ $(am__objects_1)
+***************
+*** 468,474 ****
+ score.c send.c sendlib.c signal.c sort.c \
+ status.c system.c thread.c charset.c history.c lib.c \
+ muttlib.c editmsg.c mbyte.c \
+! url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
+
+ nodist_mutt_SOURCES = $(BUILT_SOURCES)
+ mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
+--- 469,476 ----
+ score.c send.c sendlib.c signal.c sort.c \
+ status.c system.c thread.c charset.c history.c lib.c \
+ muttlib.c editmsg.c mbyte.c \
+! url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c \
+! sidebar.c
+
+ nodist_mutt_SOURCES = $(BUILT_SOURCES)
+ mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
+***************
+*** 500,506 ****
+ README.SSL smime.h group.h \
+ muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
+ ChangeLog mkchangelog.sh mutt_idna.h \
+! snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \
+ txt2c.c txt2c.sh version.sh check_sec.sh
+
+ EXTRA_SCRIPTS = smime_keys
+--- 502,508 ----
+ README.SSL smime.h group.h \
+ muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
+ ChangeLog mkchangelog.sh mutt_idna.h \
+! snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in \
+ txt2c.c txt2c.sh version.sh check_sec.sh
+
+ EXTRA_SCRIPTS = smime_keys
+*** mutt-1.5.23-orig/mbox.c 2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/mbox.c 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 100,105 ****
+--- 100,106 ----
+ mutt_perror (ctx->path);
+ return (-1);
+ }
++ ctx->atime = sb.st_atime;
+ ctx->mtime = sb.st_mtime;
+ ctx->size = sb.st_size;
+
+***************
+*** 251,256 ****
+--- 252,258 ----
+
+ ctx->size = sb.st_size;
+ ctx->mtime = sb.st_mtime;
++ ctx->atime = sb.st_atime;
+
+ #ifdef NFS_ATTRIBUTE_HACK
+ if (sb.st_mtime > sb.st_atime)
+*** mutt-1.5.23-orig/menu.c 2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/menu.c 2014-04-12 21:31:16.000000000 -0500
+***************
+*** 24,29 ****
+--- 24,30 ----
+ #include "mutt_curses.h"
+ #include "mutt_menu.h"
+ #include "mbyte.h"
++ #include "sidebar.h"
+
+ extern size_t UngetCount;
+
+***************
+*** 186,192 ****
+ {
+ char *scratch = safe_strdup (s);
+ int shift = option (OPTARROWCURSOR) ? 3 : 0;
+! int cols = COLS - shift;
+
+ mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
+ s[n - 1] = 0;
+--- 187,193 ----
+ {
+ char *scratch = safe_strdup (s);
+ int shift = option (OPTARROWCURSOR) ? 3 : 0;
+! int cols = COLS - shift - SidebarWidth;
+
+ mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
+ s[n - 1] = 0;
+***************
+*** 239,244 ****
+--- 240,246 ----
+ int do_color;
+ int attr;
+
++ draw_sidebar(1);
+ for (i = menu->top; i < menu->top + menu->pagelen; i++)
+ {
+ if (i < menu->max)
+***************
+*** 249,255 ****
+ menu_pad_string (buf, sizeof (buf));
+
+ ATTRSET(attr);
+! move(i - menu->top + menu->offset, 0);
+ do_color = 1;
+
+ if (i == menu->current)
+--- 251,257 ----
+ menu_pad_string (buf, sizeof (buf));
+
+ ATTRSET(attr);
+! move(i - menu->top + menu->offset, SidebarWidth);
+ do_color = 1;
+
+ if (i == menu->current)
+***************
+*** 272,278 ****
+ else
+ {
+ NORMAL_COLOR;
+! CLEARLINE(i - menu->top + menu->offset);
+ }
+ }
+ NORMAL_COLOR;
+--- 274,280 ----
+ else
+ {
+ NORMAL_COLOR;
+! CLEARLINE_WIN (i - menu->top + menu->offset);
+ }
+ }
+ NORMAL_COLOR;
+***************
+*** 289,295 ****
+ return;
+ }
+
+! move (menu->oldcurrent + menu->offset - menu->top, 0);
+ ATTRSET(menu->color (menu->oldcurrent));
+
+ if (option (OPTARROWCURSOR))
+--- 291,297 ----
+ return;
+ }
+
+! move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth);
+ ATTRSET(menu->color (menu->oldcurrent));
+
+ if (option (OPTARROWCURSOR))
+***************
+*** 301,313 ****
+ {
+ menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
+ menu_pad_string (buf, sizeof (buf));
+! move (menu->oldcurrent + menu->offset - menu->top, 3);
+ print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
+ }
+
+ /* now draw it in the new location */
+ SETCOLOR(MT_COLOR_INDICATOR);
+! mvaddstr(menu->current + menu->offset - menu->top, 0, "->");
+ }
+ else
+ {
+--- 303,315 ----
+ {
+ menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
+ menu_pad_string (buf, sizeof (buf));
+! move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3);
+ print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
+ }
+
+ /* now draw it in the new location */
+ SETCOLOR(MT_COLOR_INDICATOR);
+! mvaddstr(menu->current + menu->offset - menu->top, SidebarWidth, "->");
+ }
+ else
+ {
+***************
+*** 320,326 ****
+ menu_make_entry (buf, sizeof (buf), menu, menu->current);
+ menu_pad_string (buf, sizeof (buf));
+ SETCOLOR(MT_COLOR_INDICATOR);
+! move(menu->current - menu->top + menu->offset, 0);
+ print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
+ }
+ menu->redraw &= REDRAW_STATUS;
+--- 322,328 ----
+ menu_make_entry (buf, sizeof (buf), menu, menu->current);
+ menu_pad_string (buf, sizeof (buf));
+ SETCOLOR(MT_COLOR_INDICATOR);
+! move(menu->current - menu->top + menu->offset, SidebarWidth);
+ print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
+ }
+ menu->redraw &= REDRAW_STATUS;
+***************
+*** 332,338 ****
+ char buf[LONG_STRING];
+ int attr = menu->color (menu->current);
+
+! move (menu->current + menu->offset - menu->top, 0);
+ menu_make_entry (buf, sizeof (buf), menu, menu->current);
+ menu_pad_string (buf, sizeof (buf));
+
+--- 334,340 ----
+ char buf[LONG_STRING];
+ int attr = menu->color (menu->current);
+
+! move (menu->current + menu->offset - menu->top, SidebarWidth);
+ menu_make_entry (buf, sizeof (buf), menu, menu->current);
+ menu_pad_string (buf, sizeof (buf));
+
+***************
+*** 872,878 ****
+
+
+ if (option (OPTARROWCURSOR))
+! move (menu->current - menu->top + menu->offset, 2);
+ else if (option (OPTBRAILLEFRIENDLY))
+ move (menu->current - menu->top + menu->offset, 0);
+ else
+--- 874,880 ----
+
+
+ if (option (OPTARROWCURSOR))
+! move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
+ else if (option (OPTBRAILLEFRIENDLY))
+ move (menu->current - menu->top + menu->offset, 0);
+ else
+*** mutt-1.5.23-orig/mh.c 2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/mh.c 2014-04-11 11:04:59.000000000 -0500
+***************
+*** 295,300 ****
+--- 295,326 ----
+ mhs_free_sequences (&mhs);
+ }
+
++ void mh_buffy_update (const char *path, int *msgcount, int *msg_unread, int *msg_flagged, time_t *sb_last_checked)
++ {
++ int i;
++ struct mh_sequences mhs;
++ memset (&mhs, 0, sizeof (mhs));
++
++ if(!option(OPTSIDEBAR))
++ return;
++
++ if (mh_read_sequences (&mhs, path) < 0)
++ return;
++
++ msgcount = 0;
++ msg_unread = 0;
++ msg_flagged = 0;
++ for (i = 0; i <= mhs.max; i++)
++ msgcount++;
++ if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN) {
++ msg_unread++;
++ }
++ if (mhs_check (&mhs, i) & MH_SEQ_FLAGGED)
++ msg_flagged++;
++ mhs_free_sequences (&mhs);
++ *sb_last_checked = time(NULL);
++ }
++
+ static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
+ {
+ int fd;
+*** mutt-1.5.23-orig/mutt_curses.h 2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/mutt_curses.h 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 64,69 ****
+--- 64,70 ----
+ #undef lines
+ #endif /* lines */
+
++ #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
+ #define CLEARLINE(x) move(x,0), clrtoeol()
+ #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
+ #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
+***************
+*** 120,125 ****
+--- 121,128 ----
+ MT_COLOR_BOLD,
+ MT_COLOR_UNDERLINE,
+ MT_COLOR_INDEX,
++ MT_COLOR_NEW,
++ MT_COLOR_FLAGGED,
+ MT_COLOR_MAX
+ };
+
+*** mutt-1.5.23-orig/mutt_menu.h 2014-03-12 11:06:17.000000000 -0500
+--- mutt-1.5.23/mutt_menu.h 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 34,39 ****
+--- 34,40 ----
+ #define REDRAW_FULL (1<<5)
+ #define REDRAW_BODY (1<<6)
+ #define REDRAW_SIGWINCH (1<<7)
++ #define REDRAW_SIDEBAR (1<<8)
+
+ #define M_MODEFMT "-- Mutt: %s"
+
+*** mutt-1.5.23-orig/mutt.h 2014-03-12 11:06:17.000000000 -0500
+--- mutt-1.5.23/mutt.h 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 421,426 ****
+--- 421,430 ----
+ OPTSAVEEMPTY,
+ OPTSAVENAME,
+ OPTSCORE,
++ OPTSIDEBAR,
++ OPTSIDEBARSHORTPATH,
++ OPTSIDEBARSORT,
++ OPTSIDEBARFOLDERINDENT,
+ OPTSIGDASHES,
+ OPTSIGONTOP,
+ OPTSORTRE,
+***************
+*** 861,866 ****
+--- 865,871 ----
+ {
+ char *path;
+ FILE *fp;
++ time_t atime;
+ time_t mtime;
+ off_t size;
+ off_t vsize;
+***************
+*** 895,900 ****
+--- 900,906 ----
+ unsigned int quiet : 1; /* inhibit status messages? */
+ unsigned int collapsed : 1; /* are all threads collapsed? */
+ unsigned int closing : 1; /* mailbox is being closed */
++ unsigned int peekonly : 1; /* just taking a glance, revert atime */
+
+ /* driver hooks */
+ void *data; /* driver specific data */
+*** mutt-1.5.23-orig/muttlib.c 2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/muttlib.c 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 1281,1286 ****
+--- 1281,1288 ----
+ pl = pw = 1;
+
+ /* see if there's room to add content, else ignore */
++ if ( DrawFullLine )
++ {
+ if ((col < COLS && wlen < destlen) || soft)
+ {
+ int pad;
+***************
+*** 1324,1329 ****
+--- 1326,1377 ----
+ col += wid;
+ src += pl;
+ }
++ }
++ else
++ {
++ if ((col < COLS-SidebarWidth && wlen < destlen) || soft)
++ {
++ int pad;
++
++ /* get contents after padding */
++ mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags);
++ len = mutt_strlen (buf);
++ wid = mutt_strwidth (buf);
++
++ /* try to consume as many columns as we can, if we don't have
++ * memory for that, use as much memory as possible */
++ pad = (COLS - SidebarWidth - col - wid) / pw;
++ if (pad > 0 && wlen + (pad * pl) + len > destlen)
++ pad = ((signed)(destlen - wlen - len)) / pl;
++ if (pad > 0)
++ {
++ while (pad--)
++ {
++ memcpy (wptr, src, pl);
++ wptr += pl;
++ wlen += pl;
++ col += pw;
++ }
++ }
++ else if (soft && pad < 0)
++ {
++ /* \0-terminate dest for length computation in mutt_wstr_trunc() */
++ *wptr = 0;
++ /* make sure right part is at most as wide as display */
++ len = mutt_wstr_trunc (buf, destlen, COLS, &wid);
++ /* truncate left so that right part fits completely in */
++ wlen = mutt_wstr_trunc (dest, destlen - len, col + pad, &col);
++ wptr = dest + wlen;
++ }
++ if (len + wlen > destlen)
++ len = mutt_wstr_trunc (buf, destlen - wlen, COLS - SidebarWidth - col, NULL);
++ memcpy (wptr, buf, len);
++ wptr += len;
++ wlen += len;
++ col += wid;
++ src += pl;
++ }
++ }
+ break; /* skip rest of input */
+ }
+ else if (ch == '|')
+*** mutt-1.5.23-orig/mx.c 2014-03-12 11:03:45.000000000 -0500
+--- mutt-1.5.23/mx.c 2014-04-11 10:14:01.000000000 -0500
+***************
+*** 580,585 ****
+--- 580,586 ----
+ * M_APPEND open mailbox for appending
+ * M_READONLY open mailbox in read-only mode
+ * M_QUIET only print error messages
++ * M_PEEK revert atime where applicable
+ * ctx if non-null, context struct to use