From 03ce61039969e80c46a879f847ff5e1f9ff1cef3 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 19 Apr 2008 22:50:01 +0000 Subject: [PATCH] =?UTF-8?q?regression:=20interactive=20use=20didn=E2=80=99?= =?UTF-8?q?t=20work=20at=20all=20oO=20the=20=E2=80=9Cfix=E2=80=9D=20is=20t?= =?UTF-8?q?o=20treat=20NUL=20bytes=20as=20width=3Dlen=3D1=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- edit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/edit.c b/edit.c index 14b1add..42f6955 100644 --- a/edit.c +++ b/edit.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.122 2008/04/19 22:15:01 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.123 2008/04/19 22:50:01 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -770,7 +770,8 @@ utf_widthadj(const char *src, const char **dst) unsigned int wc; int width; - if (!Flag(FUTFHACK) || (len = utf_mbtowc(&wc, src)) == (size_t)-1) + if (!Flag(FUTFHACK) || (len = utf_mbtowc(&wc, src)) == (size_t)-1 || + wc == 0) len = width = 1; else width = utf_wcwidth(wc);