diff --git a/expr.c b/expr.c index cf08b50..f899952 100644 --- a/expr.c +++ b/expr.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.83 2016/03/01 18:29:38 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.84 2016/05/05 21:33:46 tg Exp $"); /* the order of these enums is constrained by the order of opinfo[] */ enum token { @@ -812,12 +812,16 @@ const char * utf_skipcols(const char *p, int cols) { int c = 0; + const char *q; while (c < cols) { if (!*p) return (p + cols - c); c += utf_widthadj(p, &p); } + if (UTFMODE) + while (utf_widthadj(p, &q) == 0) + p = q; return (p); }