From 0d73424edf1476696270c7bbb2f79764c05a3e5e Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 21 Mar 2019 15:59:42 +0100 Subject: mscan: u8putstr: assume wcwidth of -1 means actually 2 (probably emojis) --- mscan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mscan.c') diff --git a/mscan.c b/mscan.c index ae4fe35..c9a00a4 100644 --- a/mscan.c +++ b/mscan.c @@ -56,7 +56,10 @@ u8putstr(FILE *out, char *s, ssize_t l, int pad) l--; fprintf(out, "%lc", (wint_t)replacement); } else { - l -= wcwidth((wchar_t)c); + int w = wcwidth((wchar_t)c); + if (w < 0) + w = 2; /* assume worst width */ + l -= w; if (l >= 0) fwrite(s, 1, r, out); } -- cgit 1.4.1