fix utf_widthadj/utf_skipcols handling for the remaining cases I can spot
This commit is contained in:
10
var.c
10
var.c
@ -28,7 +28,7 @@
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.201 2016/03/01 20:28:33 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.202 2016/05/05 22:56:15 tg Exp $");
|
||||
|
||||
/*-
|
||||
* Variables
|
||||
@ -649,14 +649,14 @@ formatstr(struct tbl *vp, const char *s)
|
||||
|
||||
p = alloc((psiz = nlen * /* MB_LEN_MAX */ 3 + 1), ATEMP);
|
||||
if (vp->flag & (RJUST|LJUST)) {
|
||||
int slen = olen, i = 0;
|
||||
int slen = olen;
|
||||
|
||||
if (vp->flag & RJUST) {
|
||||
const char *qq = s;
|
||||
const char *qq;
|
||||
int n = 0;
|
||||
|
||||
while (i < slen)
|
||||
i += utf_widthadj(qq, &qq);
|
||||
qq = utf_skipcols(s, slen, &slen);
|
||||
|
||||
/* strip trailing spaces (AT&T uses qq[-1] == ' ') */
|
||||
while (qq > s && ksh_isspace(qq[-1])) {
|
||||
--qq;
|
||||
|
Reference in New Issue
Block a user