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 4e77b307dc
commit dddb8e1751

View File

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