* 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 "mime.h"
{
char prefix[SHORT_STRING], buf[LONG_STRING], *cp, *wptr = dest, ch;
char ifstring[SHORT_STRING], elsestring[SHORT_STRING];
- size_t wlen, count, len;
+ size_t wlen, count, len, col, wid;
prefix[0] = '\0';
destlen--; /* save room for the terminal \0 */
wlen = (flags & M_FORMAT_ARROWCURSOR && option (OPTARROWCURSOR)) ? 3 : 0;
+ col = wlen;
while (*src && wlen < destlen)
{
{
*wptr++ = '%';
wlen++;
+ col++;
src++;
continue;
}
ch = *src++; /* pad char */
/* calculate space left on line. if we've already written more data
than will fit on the line, ignore the rest of the line */
- if ( DrawFullLine )
+ if ( DrawFullLine || option(OPTSTATUSONTOP))
count = (COLS < destlen ? COLS : destlen);
else
- count = ((COLS-SidebarWidth) < destlen ? COLS - SidebarWidth : destlen);
- if (count > wlen)
+ count = ((COLS-SidebarWidth) < destlen ? (COLS - SidebarWidth) : destlen);
+ if (count > col)
{
- count -= wlen; /* how many chars left on this line */
+ count -= col; /* how many columns left on this line */
mutt_FormatString (buf, sizeof (buf), src, callback, data, flags);
- len = mutt_strlen (buf);
- if (count > len)
+ wid = mutt_strlen (buf);
+ if (count > wid)
{
- count -= len; /* how many chars to pad */
+ count -= wid; /* how many chars to pad */
memset (wptr, ch, count);
wptr += count;
- wlen += count;
+ col += count;
}
- if (len + wlen > destlen)
+ if (wid + wlen > destlen)
len = destlen - wlen;
+ else
+ len = wid;
memcpy (wptr, buf, len);
wptr += len;
wlen += len;
+ col += mutt_strwidth (buf);
}
break; /* skip rest of input */
}
memcpy (wptr, buf, len);
wptr += len;
wlen += len;
+ col += mutt_strwidth (buf);
}
}
else if (*src == '\\')
src++;
wptr++;
wlen++;
+ col++;
}
else
{
*wptr++ = *src++;
wlen++;
+ col++;
}
}
*wptr = 0;
const char *mutt_make_version (void)
{
static char vstring[STRING];
- snprintf (vstring, sizeof (vstring), "Mutt %s (%s)",
+ snprintf (vstring, sizeof (vstring), "Mutt-ng %s (%s)",
MUTT_VERSION, ReleaseDate);
return vstring;
}