preliminary fix for the ${foo/@(%)/x} not working in UTFMODE problem:

the width for control characters (wcwidth(wc) == -1) was hard-coded
to 2 (!) in utf_widthadj, which is true for *only* one of the two x_zotc*
functions in Emacs editing mode, and none of the other functions which
use this piece of code

change to 1, to be more correct in the general case; use of the UTF C1
control characters U+0080‥U+009F is slightly broken anyway, and this
only shifts the brokenness to different places of code

XXX maybe we want to map U+0080‥U+009F into Unicode as if they were
XXX 0x80‥0x9F in ANSI cp1252 instead, at least for displaying?

the editing code is cruel…
This commit is contained in:
tg 2009-02-22 18:57:19 +00:00
parent a97a514aba
commit 3d3a7e545a

5
edit.c
View File

@ -5,7 +5,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.150 2009/02/20 13:19:04 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.151 2009/02/22 18:57:19 tg Exp $");
/* tty driver characters we are interested in */
typedef struct {
@ -726,7 +726,8 @@ utf_widthadj(const char *src, const char **dst)
if (dst)
*dst = src + len;
return (width == -1 ? 2 : width);
/* XXX (width == -1 ? 2 : width) for x_zotc3 but appar. noth. else */
return (width == -1 ? 1 : width);
}
int