Re: svn commit: r352558 - head/usr.bin/top

From: Mark Millard <>
Date: Thu, 28 Nov 2019 13:08:57 -0800
> Author: daichi
> Date: Fri Sep 20 17:37:23 2019
> New Revision: 352558
> URL: 
> Log:
>   top(1): support multibyte characters in command names (ARGV array)
>   depending on locale.
>    - add setlocale()
>    - remove printable() function
>    - add VIS_OCTAL and VIS_SAFE to the flag of strvisx() to display
>      non-printable characters that do not use C-style backslash sequences
>      in three digit octal sequence, or remove it
>   This change allows multibyte characters to be displayed according to
>   locale. If it is recognized as a non-display character according to the
>   locale, it is displayed in three digit octal sequence.

Initially picking on tab characters as an example of what is
probably a somewhat broader issue . . .

Ever since this change, characters like tabs that do not fit
in the next character cell when output, but for which they
are !isprintable(...), now mess up the top display. Again
using tab as an example: line wrapping from the text having
been shifted over by more than one character cell. top does
not track the line wrapping result in how it decides what
to output for the following display updates.

As stands I type "hh" to referesh the display when I care
about clearing up the messy display.

The removed !isprintable handling functionality had its uses
and an alternative is needed for some types of characters if
the display is not to be messed up by what some command lines
that are echoed have in them.

I picked on tab because it was obviously involved in some
examples that I watched update. I'm not claiming tab is the
only character that ends up with e cursor in an unexpected
place now. In fact . . .

Looking around I found:

     VIS_SAFE	 Only encode "unsafe" characters.  Unsafe means control char-
		 acters which may cause common terminals to perform unexpected
		 functions.  Currently this form allows space, tab, newline,
		 backspace, bell, and return - in addition to all graphic
		 characters - unencoded.

So tab, newline, backspace, bell, and return are not encoded
or replaced now but do not have top's expected cursor position

Mark Millard
marklmi at
( went
away in early 2018-Mar)
Received on Thu Nov 28 2019 - 20:09:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:22 UTC