From 029a4631724fba1e2a99e740103e99e6b8409b36 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Wed, 28 Feb 2018 00:00:00 -0600 Subject: [PATCH] top: show that truncation indicator ('+') consistently With a little luck, this should be the final tweak for our support of extra wide characters. Currently, those characters don't always display the '+' indicator when they've been truncated. Now, it should always be seen. [ plus it's done a tad more efficiently via snprintf ] Signed-off-by: Jim Warner --- top/top.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/top/top.c b/top/top.c index 195274d1..50c9b322 100644 --- a/top/top.c +++ b/top/top.c @@ -1673,9 +1673,8 @@ static inline const char *make_str_utf8 (const char *str, int width, int justr, int delta = utf8_delta(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%c", utf8_embody(str, width-1), str, COLPLUSCH); delta = utf8_delta(buf); - buf[width + delta - 1] = COLPLUSCH; AUTOX_COL(col); } return justify_pad(buf, width + delta, justr);