]> granicus.if.org Git - procps-ng/commit
top: added utf8 multibyte support to additional fields
authorJim Warner <james.warner@comcast.net>
Wed, 23 Dec 2020 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Mon, 28 Dec 2020 21:48:23 +0000 (08:48 +1100)
commit9c212a7e77eaf031399ab9e0f26d4940264615c9
treedc77b058503dfd0de16d0ca839e3b3d89b386c24
parent91897e7d2c161e8819d1dd27b1c50c1fb93a4708
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