1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-04 20:16:44 +02:00

Use widechars to display strings in the UI

This fixes a bug where printing a bunch of UTF8 chars with glyphs
that have a size > 1 would make the entire chat window disappear.
It also fixes an issue where said UTF8 chars would be truncated
and generally not display correctly.
This commit is contained in:
jfreegman
2022-01-27 15:45:56 -05:00
parent f6f41a510b
commit e122c5dbca
3 changed files with 84 additions and 45 deletions

View File

@ -46,11 +46,11 @@ typedef enum LINE_TYPE {
} LINE_TYPE;
struct line_info {
char timestr[TIME_STR_SIZE];
char name1[TOXIC_MAX_NAME_LENGTH + 1];
char name2[TOXIC_MAX_NAME_LENGTH + 1];
char msg[MAX_LINE_INFO_MSG_SIZE];
time_t timestamp;
char timestr[TIME_STR_SIZE];
char name1[TOXIC_MAX_NAME_LENGTH + 1];
char name2[TOXIC_MAX_NAME_LENGTH + 1];
wchar_t msg[MAX_LINE_INFO_MSG_SIZE];
time_t timestamp;
uint8_t type;
uint8_t bold;
uint8_t colour;
@ -58,7 +58,7 @@ struct line_info {
bool read_flag; /* true if a message has been flagged as read */
uint32_t id;
uint16_t len; /* combined length of entire line */
uint16_t msg_len; /* length of the message */
uint16_t msg_width; /* width of the message */
uint16_t format_lines; /* number of lines the combined string takes up (dynamically set) */
struct line_info *prev;