Commits

Anonymous committed e1269e5

use width() during insertion

Comments (0)

Files changed (1)

 	static int escape = 0, wstart = 0, in_mb = 0;
 	int rdlen, i, mask, tmp;
 	char c;
-	wchar_t wc;
 	fd_set rd;
 
 	for (;;) {
 								wstart = cur;
 							} else if ((c & 0xc0) == 0x80) { // continuation of multibyte character
 								if (--in_mb == 0) { // end of multibyte character
-									if (mbtowc(&wc, usrbuf + wstart, cur - wstart + 1) <= 0)
-										warnx("failed multibyte to wide char conversion");
-									if ((i = wcwidth(wc)) < 0)
-										warnx("failed to find width of wide char");
+									i = width(usrbuf, &wstart, len, 1);
 									wcur += i;
 									wlen += i;
 								}