handle combining characters at the end of the string correctly
This commit is contained in:
parent
2e74da0953
commit
152eee2085
6
expr.c
6
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user