Upon reflection, there was absolutely no justification
for that call to strlen() which was then followed by a
call to snprintf(). The latter provides this needed #.
[ also make that 'delta' value a little more visible ]
[ instead of hiding it at the end of a its code line ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
static char buf[SCREENMAX];
int delta = utf8_delta(str);
- if (width >= (int)strlen(str) - delta)
- snprintf(buf, sizeof(buf), "%s", str);
- else {
+ if (width + delta <= snprintf(buf, sizeof(buf), "%s", str)) {
snprintf(buf, sizeof(buf), "%.*s", utf8_embody(str, width - 1), str);
delta = utf8_delta(buf);
buf[width + delta - 1] = COLPLUSCH;