NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
mbyte.h
Go to the documentation of this file.
1
23#ifndef MUTT_MUTT_MBYTE_H
24#define MUTT_MUTT_MBYTE_H
25
26#include "config.h"
27#include <ctype.h>
28#include <stdbool.h>
29#include <stddef.h>
30#include <wctype.h> // IWYU pragma: keep
31
32struct Buffer;
33
34extern bool OptLocales;
35
36#ifdef LOCALES_HACK
37#define IsPrint(ch) (isprint((unsigned char) (ch)) || ((unsigned char) (ch) >= 0xa0))
38#define IsWPrint(wc) (iswprint(wc) || wc >= 0xa0)
39#else
40#define IsPrint(ch) (isprint((unsigned char) (ch)) || (OptLocales ? 0 : ((unsigned char) (ch) >= 0xa0)))
41#define IsWPrint(wc) (iswprint(wc) || (OptLocales ? 0 : (wc >= 0xa0)))
42#endif
43
44int mutt_mb_charlen(const char *s, int *width);
45int mutt_mb_filter_unprintable(char **s);
46bool mutt_mb_get_initials(const char *name, char *buf, size_t buflen);
48bool mutt_mb_is_lower(const char *s);
49bool mutt_mb_is_shell_char(wchar_t ch);
50size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, const char *buf);
51void buf_mb_wcstombs(struct Buffer *dest, const wchar_t *wstr, size_t wlen);
52int mutt_mb_wcswidth(const wchar_t *s, size_t n);
53int mutt_mb_wcwidth(wchar_t wc);
54int mutt_mb_width(const char *str, int col, bool indent);
55size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1);
56
57#endif /* MUTT_MUTT_MBYTE_H */
int mutt_mb_charlen(const char *s, int *width)
Count the bytes in a (multibyte) character.
Definition: mbyte.c:55
bool mutt_mb_is_shell_char(wchar_t ch)
Is character not typically part of a pathname.
Definition: mbyte.c:340
int mutt_mb_filter_unprintable(char **s)
Replace unprintable characters.
Definition: mbyte.c:423
size_t mutt_mb_width_ceiling(const wchar_t *s, size_t n, int w1)
Keep the end of the string on-screen.
Definition: mbyte.c:237
bool OptLocales
(pseudo) set if user has valid locale definition
Definition: mbyte.c:44
bool mutt_mb_get_initials(const char *name, char *buf, size_t buflen)
Turn a name into initials.
Definition: mbyte.c:82
bool mutt_mb_is_display_corrupting_utf8(wchar_t wc)
Will this character corrupt the display?
Definition: mbyte.c:385
size_t mutt_mb_mbstowcs(wchar_t **pwbuf, size_t *pwbuflen, size_t i, const char *buf)
Convert a string from multibyte to wide characters.
Definition: mbyte.c:291
int mutt_mb_wcswidth(const wchar_t *s, size_t n)
Measure the screen width of a string.
Definition: mbyte.c:216
bool mutt_mb_is_lower(const char *s)
Does a multi-byte string contain only lowercase characters?
Definition: mbyte.c:354
int mutt_mb_width(const char *str, int col, bool indent)
Measure a string's display width (in screen columns)
Definition: mbyte.c:137
void buf_mb_wcstombs(struct Buffer *dest, const wchar_t *wstr, size_t wlen)
Convert a string from wide to multibyte characters.
Definition: mbyte.c:256
int mutt_mb_wcwidth(wchar_t wc)
Measure the screen width of a character.
Definition: mbyte.c:198
String manipulation buffer.
Definition: buffer.h:36