top: extend multi-byte support to 'Inspection' feature
The previous commit implemented multi-byte support for the basic top user interaction and display provisions. This commit completes multi-byte support by addressing that 'Inspect Other Output' feature (the 'Y' command). Few people probably exploit this very powerful feature which allows the perusing of any file or piped output. And even if nobody uses 'Y', someone will stumble over it on the help screen and try it out. Assuming top was not built with INSP_OFFDEMO defined, they'll end up on the screen our translators have faithfully translated. Without this patch, such a screen would display with a bunch of 'unprintable' characters which will then show in the standard (less-like) way as: '^A', '<C3>', etc. In other words, those poor screens will be a big mess! [ this program can even display an executable binary ] [ while at that same time supporting Find/Find Next. ] [ imagine, a file with no guarantee of real strings! ] [ just try a Find using less with such binary files. ] With this commit, the translated 'Y' demo screens will now be properly shown, providing no invalid multi-byte characters have been detected. Should that be the case then they'll be displayed in that less-like way above. And, if users go on to fully exploit this 'Y' command, there is a good chance that a file or pipe might yield output in a utf-8 multi-byte form. Should that be true such output will thus be handled appropriately by top. [ in many respects, this change was more challenging ] [ than the basic support within the previous commit. ] [ story of my life: least used = most effort needed. ] Many thanks to our procps-ng translators which enabled a proper test of these changed 'Y' command provisions: . Vietnamese: Trần Ngọc Quân . Polish: Jakub Bogusz . German: Mario Blättermann . French: Frédéric Marchal, Stéphane Aulery [ and my sincerest apologies too, for my negligence! ] Reference(s): https://gitlab.com/procps-ng/procps/issues/68 Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@@ -552,6 +552,7 @@ typedef struct WIN_t {
|
||||
//atic int utf8_delta (const char *str);
|
||||
//atic int utf8_embody (const char *str, int width);
|
||||
//atic const char *utf8_justify (const char *str, int width, int justr);
|
||||
//atic int utf8_proper_col (const char *str, int col, int tophysical);
|
||||
/*------ Misc Color/Display support ------------------------------------*/
|
||||
//atic void capsmk (WIN_t *q);
|
||||
//atic void show_msg (const char *str);
|
||||
@@ -606,7 +607,8 @@ typedef struct WIN_t {
|
||||
//atic void insp_do_pipe (char *fmts, int pid);
|
||||
//atic inline int insp_find_ofs (int col, int row);
|
||||
//atic void insp_find_str (int ch, int *col, int *row);
|
||||
//atic inline void insp_make_row (int col, int row);
|
||||
//atic void insp_mkrow_raw (int col, int row);
|
||||
//atic void insp_mkrow_utf8 (int col, int row);
|
||||
//atic void insp_show_pgs (int col, int row, int max);
|
||||
//atic int insp_view_choice (struct pids_stack *obj);
|
||||
//atic void inspection_utility (int pid);
|
||||
|
Reference in New Issue
Block a user