diff -uNr screen-4.0.3/ansi.c screen.1/ansi.c --- screen-4.0.3/ansi.c 2003-12-05 21:57:05.000000000 +0800 +++ screen.1/ansi.c 2009-04-06 13:13:46.000000000 +0800 @@ -1440,6 +1440,19 @@ StringChar(c) int c; { +#ifdef UTF8 + if (curr->w_encoding == UTF8) + { + char buf[] = { 0, 0, 0, 0 }; /* last one is the \0 terminator. */ + int i, len = ToUtf8(buf, c); + if (curr->w_stringp >= curr->w_string + MAXSTR - len) + curr->w_state = LIT; + for (i=0; iw_stringp++ = buf[i]; + debug1("StringChar: %s\n", buf); + return; + } +#endif if (curr->w_stringp >= curr->w_string + MAXSTR - 1) curr->w_state = LIT; else diff -uNr screen-4.0.3/display.c screen.1/display.c --- screen-4.0.3/display.c 2003-12-05 21:45:41.000000000 +0800 +++ screen.1/display.c 2009-04-06 13:25:21.000000000 +0800 @@ -2405,9 +2410,9 @@ AddCStr2(D_TS, 0); max = D_WS > 0 ? D_WS : (D_width - !D_CLP); if ((int)strlen(str) > max) - AddStrn(str, max); + AddStrnPlain(str, max); else - AddStr(str); + AddStrPlain(str); AddCStr(D_FS); D_hstatus = 1; } @@ -3111,6 +3121,18 @@ } void +AddStrPlain(str) +char *str; +{ + register char c; + + ASSERT(display); + + while ((c = *str++)) + AddChar(c); +} + +void AddStrn(str, n) char *str; int n; @@ -3133,6 +3155,21 @@ } void +AddStrnPlain(str, n) +char *str; +int n; +{ + register char c; + + ASSERT(display); + while ((c = *str++) && n-- > 0) + AddChar(c); + while (n-- > 0) + AddChar(' '); +} + + +void Flush() { register int l; diff -uNr screen-4.0.3/extern.h screen.1/extern.h --- screen-4.0.3/extern.h 2003-08-22 20:27:57.000000000 +0800 +++ screen.1/extern.h 2009-04-06 13:26:18.000000000 +0800 @@ -281,6 +281,8 @@ extern int ResizeDisplay __P((int, int)); extern void AddStr __P((char *)); extern void AddStrn __P((char *, int)); +extern void AddStrPlain __P((char *)); +extern void AddStrnPlain __P((char *, int)); extern void Flush __P((void)); extern void freetty __P((void)); extern void Resize_obuf __P((void));