top: try to avoid premature truncation indicator ('+')

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2018-01-27 00:00:00 -06:00 committed by Craig Small
parent 3aa348ad77
commit 0f54ff181a

View File

@ -1472,7 +1472,7 @@ static inline const char *make_str_utf8 (const char *str, int width, int justr,
static char buf[SCREENMAX];
int delta = utf8_delta(str);
if (width + delta <= snprintf(buf, sizeof(buf), "%s", str)) {
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;