Last active
November 19, 2019 05:59
-
-
Save rcmdnk/8a90eba829fd789a4e058492b494f862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/ansi.c | |
+++ b/src/ansi.c | |
@@ -1508,8 +1508,24 @@ | |
{ | |
if (curr->w_stringp >= curr->w_string + MAXSTR - 1) | |
curr->w_state = LIT; | |
+# ifdef UTF8 | |
+ else if (c < 0x80) | |
+ *(curr->w_stringp)++ = c; | |
+ else if (c < 0x800) | |
+ { | |
+ *(curr->w_stringp)++ = (c >> 6) | 0xc0; | |
+ *(curr->w_stringp)++ = (c & 0x3f) | 0xc0; | |
+ } | |
+ else /* if (c < 0x10000) */ | |
+ { | |
+ *(curr->w_stringp)++ = (c >> 12) | 0xe0; | |
+ *(curr->w_stringp)++ = (c >> 6) & 0x3f | 0x80; | |
+ *(curr->w_stringp)++ = (c & 0x3f) | 0x80; | |
+ } | |
+# else | |
else | |
*(curr->w_stringp)++ = c; | |
+# endif | |
} | |
/* | |
@@ -1628,7 +1644,7 @@ | |
} | |
return -1; | |
case DCS: | |
- LAY_DISPLAYS(&curr->w_layer, AddStr(curr->w_string)); | |
+ LAY_DISPLAYS(&curr->w_layer, AddRawStr(curr->w_string)); | |
break; | |
case AKA: | |
if (curr->w_title == curr->w_akabuf && !*curr->w_string) | |
@@ -2263,7 +2278,11 @@ | |
c = (unsigned char)*s++; | |
if (c == 0) | |
break; | |
+#ifdef UTF8 | |
+ if (c < 32) | |
+#else | |
if (c < 32 || c == 127 || (c >= 128 && c < 160 && p->w_c1)) | |
+#endif | |
continue; | |
p->w_akachange[i++] = c; | |
} | |
--- a/src/display.c | |
+++ b/src/display.c | |
@@ -2961,7 +2961,7 @@ | |
D_xtermosc[i] = 1; | |
AddStr("\033]"); | |
AddStr(oscs[i][0]); | |
- AddStr(s); | |
+ AddRawStr(s); | |
AddStr(t); | |
} | |
@@ -3002,6 +3002,18 @@ | |
} | |
void | |
+AddRawStr(str) | |
+char *str; | |
+{ | |
+ register char c; | |
+ | |
+ ASSERT(display); | |
+ | |
+ while ((c = *str++)) | |
+ AddChar(c); | |
+} | |
+ | |
+void | |
AddStrn(str, n) | |
char *str; | |
int n; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment