51 if (!buf || (pad_char ==
'\0'))
66 memset(buf->
dptr, pad_char, max_cols);
74 memmove(buf->
data + (max_cols / 2), buf->
data, len);
75 memset(buf->
data, pad_char, max_cols / 2);
77 memset(buf->
data + len + (max_cols / 2), pad_char, (max_cols + 1) / 2);
83 memmove(buf->
data + max_cols, buf->
data, len);
84 memset(buf->
data, pad_char, max_cols);
89 buf->
dptr += max_cols;
109 char pad_char,
const char *str,
size_t n,
bool arboreal)
114 char scratch[MB_LEN_MAX] = { 0 };
115 mbstate_t mbstate1 = { 0 };
116 mbstate_t mbstate2 = { 0 };
117 bool escaped =
false;
120 for (; (n > 0) && (k = mbrtowc(&wc, str, n, &mbstate1)); str += k, n -= k)
125 memset(&mbstate1, 0,
sizeof(mbstate1));
146 else if (iswspace(wc))
167 size_t k2 = wcrtomb(scratch, wc, &mbstate2);
size_t buf_addstr_n(struct Buffer *buf, const char *s, size_t len)
Add a string to a Buffer, expanding it if necessary.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
wchar_t ReplacementChar
When a Unicode character can't be displayed, use this instead.
#define ICONV_BUF_TOO_SMALL
Error value for iconv() - Buffer too small.
#define ICONV_ILLEGAL_SEQ
Error value for iconv() - Illegal sequence.
Convenience wrapper for the library headers.
Create/manipulate threading in emails.
@ MUTT_SPECIAL_INDEX
Colour indicator.
String manipulation buffer.
char * dptr
Current read/write position.
char * data
Pointer to data.