Commit 10f5ca3e authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Make to_chars and status_chars accept mulitibyte characters. (closes #3024)

Change Tochars and StChars to use the mbchars_table type introduced in
the last commit.
parent 3d18f19c
......@@ -144,10 +144,10 @@ WHERE short SslDHPrimeBits;
WHERE char *SslCACertFile INITVAL (NULL);
#endif
#endif
WHERE char *StChars;
WHERE mbchar_table *StChars;
WHERE char *Status;
WHERE char *Tempdir;
WHERE char *Tochars;
WHERE mbchar_table *Tochars;
WHERE char *TrashPath;
WHERE char *TSStatusFormat;
WHERE char *TSIconFormat;
......
......@@ -620,9 +620,9 @@ hdr_format_str (char *dest,
break;
case 'T':
snprintf (fmt, sizeof (fmt), "%%%sc", prefix);
snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
snprintf (dest, destlen, fmt,
(Tochars && ((i = mutt_user_is_recipient (hdr))) < mutt_strlen (Tochars)) ? Tochars[i] : ' ');
(Tochars && ((i = mutt_user_is_recipient (hdr))) < Tochars->len) ? Tochars->chars[i] : " ");
break;
case 'u':
......@@ -668,13 +668,13 @@ hdr_format_str (char *dest,
ch = 'K';
snprintf (buf2, sizeof (buf2),
"%c%c%c", (THREAD_NEW ? 'n' : (THREAD_OLD ? 'o' :
"%c%c%s", (THREAD_NEW ? 'n' : (THREAD_OLD ? 'o' :
((hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno))
? (hdr->replied ? 'r' : ' ') : (hdr->old ? 'O' : 'N')))),
hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch),
hdr->tagged ? '*' :
(hdr->flagged ? '!' :
(Tochars && ((i = mutt_user_is_recipient (hdr)) < mutt_strlen (Tochars)) ? Tochars[i] : ' ')));
hdr->tagged ? "*" :
(hdr->flagged ? "!" :
(Tochars && ((i = mutt_user_is_recipient (hdr)) < Tochars->len) ? Tochars->chars[i] : " ")));
mutt_format_s (dest, destlen, prefix, buf2);
break;
......
......@@ -3386,7 +3386,7 @@ struct option_t MuttVars[] = {
** required.)
*/
#endif /* defined(USE_SSL) */
{ "status_chars", DT_STR, R_BOTH, UL &StChars, UL "-*%A" },
{ "status_chars", DT_MBCHARTBL, R_BOTH, UL &StChars, UL "-*%A" },
/*
** .pp
** Controls the characters used by the ``%r'' indicator in
......@@ -3570,7 +3570,7 @@ struct option_t MuttVars[] = {
** this variable is not set, the environment variable \fC$$$TMPDIR\fP is
** used. If \fC$$$TMPDIR\fP is not set then ``\fC/tmp\fP'' is used.
*/
{ "to_chars", DT_STR, R_BOTH, UL &Tochars, UL " +TCFL" },
{ "to_chars", DT_MBCHARTBL, R_BOTH, UL &Tochars, UL " +TCFL" },
/*
** .pp
** Controls the character used to indicate mail addressed to you. The
......
......@@ -228,14 +228,12 @@ status_format_str (char *buf, size_t buflen, size_t col, int cols, char op, cons
Context->deleted)) ? 1 : 0);
}
if (!StChars)
if (!StChars || !StChars->len)
buf[0] = 0;
else if (i >= mutt_strlen(StChars))
buf[0] = StChars[0];
else if (i >= StChars->len)
snprintf (buf, buflen, "%s", StChars->chars[0]);
else
buf[0] = StChars[i];
buf[1] = 0;
snprintf (buf, buflen, "%s", StChars->chars[i]);
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment