attempt a better fix: break off widthadj upon encountering NUL,

add remaining columns as octets (should also speed optimise)
This commit is contained in:
tg
2009-12-05 20:17:59 +00:00
parent 86d4dee0da
commit 703551bd4f
2 changed files with 7 additions and 4 deletions

7
expr.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.39 2009/11/28 14:28:00 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.40 2009/12/05 20:17:58 tg Exp $");
/* The order of these enums is constrained by the order of opinfo[] */
enum token {
@ -710,8 +710,11 @@ utf_skipcols(const char *p, int cols)
{
int c = 0;
while (c < cols)
while (c < cols) {
if (!*p)
return (p + cols - c);
c += utf_widthadj(p, &p);
}
return (p);
}