]> granicus.if.org Git - procps-ng/commit
top: added utf8 multibyte support to additional fields
authorJim Warner <james.warner@comcast.net>
Thu, 24 Dec 2020 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Mon, 28 Dec 2020 21:42:28 +0000 (08:42 +1100)
commitc76144ead1cb2e10267751f0434f617e03084a91
treeab8ad5aebbd7e2f0cc7e4da9022a6ee49feee20e
parentbe2229125736521cff5d42f9da764c7205582b7f
top: added utf8 multibyte support to additional fields

When any process' command line contains multibyte utf8
characters, two separate display problems could arise.

1. If that COMMAND column is not displayed as the very
last field, then field(s) to the right are misaligned.

2. Even when last, should utf8 string length (not that
display length) exceed allowable screen width, it will
nonetheless suffer from improper premature truncation.

Number 1 is less of a concern since the cmdline column
is likely to always be the last field to be displayed,
if only to enable right and left scrolling provisions.

Number 2 is much more likely to occur, especially with
additional fields which might be shown before COMMAND.
Or, forest view child tasks can yield the same effect.

So, this commit will permit the correct utf8 multibyte
display regardless of field position or string length.

And, we'll bring top into line with the ps program for
additional fields potentially subject to utf8 display.

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c