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" #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[] */ /* The order of these enums is constrained by the order of opinfo[] */
enum token { enum token {
@ -710,8 +710,11 @@ utf_skipcols(const char *p, int cols)
{ {
int c = 0; int c = 0;
while (c < cols) while (c < cols) {
if (!*p)
return (p + cols - c);
c += utf_widthadj(p, &p); c += utf_widthadj(p, &p);
}
return (p); return (p);
} }

4
lex.c
View File

@ -22,7 +22,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.102 2009/12/05 19:44:09 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/lex.c,v 1.103 2009/12/05 20:17:59 tg Exp $");
/* /*
* states while lexing word * states while lexing word
@ -1326,7 +1326,7 @@ getsc_line(Source *s)
/* Done here to ensure nothing odd happens when a timeout occurs */ /* Done here to ensure nothing odd happens when a timeout occurs */
XcheckN(s->xs, xp, LINE); XcheckN(s->xs, xp, LINE);
memset(xp, 0, LINE); *xp = '\0';
s->start = s->str = xp; s->start = s->str = xp;
if (have_tty && ksh_tmout) { if (have_tty && ksh_tmout) {