Line 0
Link Here
|
|
|
1 |
--- utf8.c.orig 2016-08-01 09:24:01 UTC |
2 |
+++ utf8.c |
3 |
@@ -115,8 +115,25 @@ utf8_width(wchar_t wc) |
4 |
int width; |
5 |
|
6 |
width = wcwidth(wc); |
7 |
- if (width < 0 || width > 0xff) |
8 |
+ if (width < 0 || width > 0xff) { |
9 |
+ log_debug("Unicode %04x, wcwidth() %d", wc, width); |
10 |
+ |
11 |
+#ifndef __OpenBSD__ |
12 |
+ /* |
13 |
+ * Many platforms (particularly and inevitably OS X) have no |
14 |
+ * width for relatively common characters (wcwidth() returns |
15 |
+ * -1); assume width 1 in this case. This will be wrong for |
16 |
+ * genuinely nonprintable characters, but they should be |
17 |
+ * rare. We may pass through stuff that ideally we would block, |
18 |
+ * but this is no worse than sending the same to the terminal |
19 |
+ * without tmux. |
20 |
+ */ |
21 |
+ if (width < 0) |
22 |
+ return (1); |
23 |
+#endif |
24 |
+ |
25 |
return (-1); |
26 |
+ } |
27 |
return (width); |
28 |
} |
29 |
|