______________________________ original newlib message
This patch introduces a new #define TOG4_MEM_FIX which
serves to turn off the new feature it also implements.
The feature, on by default, provides a flexible memory
graph approach which strives to always keep its visual
separator in alignment with cpu separators seen above.
Below is a summary of the algorithm implementing this:
1) First, ascertain the widest graph which corresponds
to the largest number of cpu graphs but doesn't exceed
maximum allowable graph width (i.e. GRAPH_length_max).
2) Next, apply that to the graphed 'Mem' portion which
is likely to remain entirely visible. However, it will
grow or shrink depending on total adjacent cpu graphs.
3) Last, the same width is used for the 'Swap' portion
but that graph is considered sacrificial and very well
could be truncated depending on the width of a screen.
[ along the way, when the cpu graphs revert to their ]
[ abbreviated form, the memory graphs will also show ]
[ an abbreviated prefix. in this way the widths will ]
[ also be maximized, reducing potential distortions. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This commit will change some comments, adjust a little
whitespace but mostly rename some #define identifiers.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
When displaying detailed memory statistics two abreast
data for the lines are less than those for cpus. So we
can exploit such a difference to provide a distinctive
separator. This may help separating cpu & memory data.
[ in truth, this happened before this patch. what we ]
[ are doing now is polishing that accidental feature ]
[ and placing it under the control of a conditional. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
When displaying detailed cpu statistics, as opposed to
those scalable graphs, only two per line can be shown.
Therefore, if we are showing a detail version, our '4'
toggle must prematurely revert to single mode display.
Conversely, the 't' toggle must also turn off that '4'
toggle rather than try to print more than 2 abreast if
we're currently executing in detailed statistics mode.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
When more than two cpus are displayed per summary area
line in graph form, those memory graphs were scaled to
that same width for consistency & aesthetics. However,
they probably shouldn't have been reduced to less than
terminal width due to a resulting loss of information.
[ after all, detailed memory stats are never reduced ]
So now, supporting logic was refactored to behave just
as it did before the 4 toggle was expanded beyond '1'.
[ the changes impact the 2 memory graphs exclusively ]
Reference(s):
https://www.freelists.org/post/procps/top-enhancements-2-bugs-swatted,1
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This patch just supplements the previous series with a
few minor tweaks representing some diverse objectives:
. a recent date for man page (which i always overlook)
. improved length calculations to maximize graph width
. a proper response to platforms with less than 8 cpus
. more consistency and readability with one blank line
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
--------------------------------------------- ( none )
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Well, here it is. This is what the preceding series of
commits was leading to: an ability to show up to eight
cpus per Summary Area line. In reality, a self imposed
limit of four cpus on such lines seems more realistic.
In any case, the new capability could also be employed
along with that '!' toggle which consolidates adjacent
cpus into a solitary graph. When used together the '4'
and '!' toggles should accommodate any number of cpus.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
I guess the cat's out of the bag with the prior commit
message. It mentioned the objective of displaying more
than the current two cpu graphs on summary area lines.
On the way to that objective, this patch just prepares
our battlefield for the actual implementation in which
up to 8 individual cpu graphs will be shown on 1 line.
[ no logic has been impacted with this commit. we're ]
[ just adding one manifest constant, trading several ]
[ identifiers and updating some comments so the next ]
[ commit might be just a little bit more manageable. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This program has always been sensitive to the width of
a terminal/console. The detailed cpu/memory statistics
plus all of those full screen replacement windows were
designed to fit within some 80 column, 24 row display.
When a user narrowed a gui terminal to less than those
dimensions, top would simply truncate the data to fit.
However, when displaying cpu/mem graphs instead of the
detailed statistics such truncation was not justified.
After all, such graphs were already scaled to 80 cols.
Henceforth, when in graph mode, truncation won't occur
until the graphs will no longer fit within 10 columns.
[ can you keep a secret? this change is really being ]
[ made in anticipation of showing more than just two ]
[ cpu graphs in the summary area on each screen row! ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
The logic (illogic?) in the sum_tics() and do_memory()
functions has grown to become almost unfathomable over
time. Additionally, though perhaps not apparent in the
code, many steps are duplicated within those routines.
So, this patch refactors all the summary graph support
to consolidate duplicated code and (hopefully) make it
more understandable with an eye to future maintenance.
[ additionally, that show_special guy's workload has ]
[ been reduced by eliminating any special directives ]
[ previously embedded in some cpu graphs even though ]
[ a cpu may have been idle during the last interval. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
----------------------------------- ( minus git hash )
When 2 abreast cpu display was introduced, the minimum
screen width was 160 columns so as to avoid (minimize)
truncation. Later that was reduced to 80 columns while
keeping the original minimum as a compile conditional.
In preparation for (virtually) eliminating these width
restrictions in a future patch this #define's history.
Reference(s):
. May, 2020 - introduced #define TOG4_NOTRUNC
commit ........................................
. May, 2020 - introduce 2 abreast display
commit ........................................
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
----------------------------------- ( minus git hash )
When two abreast display was introduce, in that commit
shown below, this #define provision was also added. It
actually was an artifact left from program development
and never made much sense in a real world application.
If activated it would make the '4' toggle appear to be
broken since it would only take affect if a user first
activated individual cpu display (the '1' toggle off).
And there was no error message offered to those users.
So, this questionable #define is now being eliminated.
Reference(s):
. May, 2020 - introduce 2 abreast display
commit ........................................
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
----------------------------------- ( minus git hash )
When top was made more responsive to keyboard input in
that commit referenced below, his previous response to
a SIGWINCH was upset. Formerly, that display integrity
was restored with the next refresh cycle. But, without
this patch, one must strike some key to accomplish it.
[ in truth, this patch vastly improves that sigwinch ]
[ response. whereas before, although integrity would ]
[ be restored automatically, it did not happen until ]
[ the next regular refresh. now it is instantaneous! ]
Reference(s):
. May, 2022 - made more responsive to kdb input
commit ........................................
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
----------------------------------- ( minus git hash )
In that issue cited below, Tyson Nottingham identified
a potential abend which was associated with 'alternate
display mode' plus that troublesome 'mkVIZrow1' macro.
He also offered a perfectly adequate fix for that bug.
I refer to that macro as troublesome since it's now so
widely used and sometimes (by design) causes 'begtask'
to go negative (invalid). And now I found yet one more
place where it should have been used but wasn't ('f').
It's also troublesome as evidenced by some git history
listed below. Heck, there was even a commit addressing
the same symptoms (alternate display mode abend) which
Tyson suffered. Clearly, the current design is flawed.
So, with those two issues in mind, I've refactored the
approach to maintaining a visible task in the 1st row.
Henceforth, a 'mkVIZrow1' macro will be issued in only
two places: once at startup and after most keystrokes.
Such an approach likely results in additional calls to
the 'window_hlp' routine that aren't really necessary.
But, it provides a cleaner design less prone to errors
in the future. Besides, such additional overhead would
only be incurred when interacting with the user. Thus,
new costs are of no concern and will never be noticed.
Reference(s):
. Tyson Nottingham reported problem
https://gitlab.com/procps-ng/procps/-/issues/245
. Jun, 2018 - visible row 1 tasks first addressed
commit ........................................
. Jun, 2018 - adressed edge case, new bugs created
commit ........................................
. Sep, 2018 - additional edge case addressed
commit ........................................
. May, 2021 - some abends fixed, new error created
commit ........................................
. Jun, 2021 - try to prorect against future errors
commit ........................................
. Sep, 2021 - integrate mkVIZ & 'focused' tasks
commit ........................................
Discovered by: Tyson Nottingham
Signed-off-by: Jim Warner <james.warner@comcast.net>
The change occurred under the newlib branch in a patch
that couldn't be ported dealing with MEMINFO_MEM_USED.
That required a library change whereas this is frozen.
Reference(s):
. Jun, 2022 - newlib branch change
commit 047d16ccfd
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
If we're deleting a character or operating in overtype
mode, we must account for the potential of 'invisible'
characters. When one follows any character about to be
deleted or replaced both multi-byte sequences must go.
Without this change, there exists the possibility that
top might report some error where no error is apparent
to the user. For example, with 'other filtering' (o/O)
the user could see "unrecognized field name 'COMMAND'"
where the quoted column name appears perfectly normal.
Or maybe a sequences like the 'combining acute accent'
gets applied to an existing character instead of being
deleted as one expects when its parent was eliminated.
So, henceforth whenever any character is being deleted
we will now check for a following 'invisible' sequence
then eliminate it along with that preceding character.
[ admittedly, these scenarios are very rare yet they ]
[ may occur, especially when recalling some previous ]
[ multi-byte strings for editing. and, since we will ]
[ be interacting with a user, performance won't be a ]
[ factor so extra checks for a zero wcwidth is fine. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
--------------------------------------------- ( none )
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This commit just provides the final protection against
possible screen corruption when processing line input.
[ such corruption was limited to the input line only ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Some kdeinit tasks have a large environment consisting
mostly of nulls which were then followed by one or two
printable characters. Such strange environments should
not be shown with that 'not applicable' (n/a) notation
even though that first string vector is equal to '\0'.
I thought I had covered such a contingency but, due to
a misplaced right parenthesis, that '^N' bottom window
could see 'n/a' + a bunch of spaces + printable stuff.
Well, that won't happen anymore with this tiny change.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
--------------------------------------------- ( none )
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
--------------------------------------------- ( none )
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This program was well equipped to properly handle utf8
multi-byte characters - except for one important area!
If users typed any unicode character (shift+ctrl+u) or
pasted a utf-8 multi-byte string as a response to some
input prompt, those characters would simply be ignored
since they would not pass the internal 'isprint' test.
Well, now we can handle such data while preserving all
line editing provisions such as insertions, deletions,
destructive backspace, prior line recall (up/down) and
those all important cursor left plus right arrow keys.
[ we even support overtype mode for multi-byte stuff ]
[ even though our gui emulator will not let us alter ]
[ the cursor as confirmation (as we do at a console) ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Given that we won't always be able to alter the cursor
shapes (from underscore to block) if in input overtype
mode, this commit will at least provide a visual clue.
[ while this libvte quirk will impact gnome-terminal ]
[ and likely others, we're able to change the cursor ]
[ shape from underscore to block at a linux console. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
----------------------------------- ( minus git hash )
In the commit shown below the bottom window was forced
off if a full screen replacement function was invoked.
It did so by setting Frames_signal after calling those
routines from the keys_global function. However, there
was sometimes a possibility such action was premature.
At least two of those full screen replacement routines
may issue an error message & return without corrupting
the screen. As such, forcing off that bottom window is
totally unnecessary. It therefore should be preserved.
So this commit just moves the setting of Frames_signal
to the full screen replacement routines when possible.
Reference(s):
. May, 2022 - bottom window forced off for some
commit ........................................
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
[ along the way, we'll fix-up the section 4 commands ]
[ summary which has gotten a little outdated lately. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Messages issued by top will be displayed for only 1.25
seconds. And while this length of time would appear to
be acceptable (given the absence of complaints), there
will be times when a specific message might be missed.
So, this commit offers users the opportunity to recall
up to 10 of the most recent messages that were issued.
[ we'll just exploit top's new bottom window feature ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
--------------------------------------------- ( none )
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Now that a potential use of that bottom 'window' for a
menu has been demonstrated, we'll remove such clutter.
[ after all, the prior commit cautioned against text ]
[ made conditional which might also be translatable. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
While it is acceptable to make text usage conditional,
one must never make the text itself conditional. After
all, the translators must be presented with all of the
text so the opportunity to translate it is never lost.
[ one wonders who the idiot was that did this anyway ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
----------------------------------- ( minus git hash )
Fix some errors introduced in the commits shown below.
Reference(s):
. Apr, 2022 - 'keys_global' missed redundancy
commit ........................................
. Apr, 2022 - added extraneous comma in help text
commit ........................................
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
If the special bottom 'window' routines remain unaware
of potential multi-byte characters, that heading could
be truncated prematurely and unnecessary blank line(s)
added to the reserved rows at the bottom of a display.
So, in both cases, this patch will now account for any
difference between string lengths and display columns.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This patch attempts to reduce the proliferation of the
bottom window support routines by combining the 'misc'
with 'item' functions. Along the way we can now rename
those two 'pick' functions 'menu' while keeping proper
alphabetic order among all the bottom window routines.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Really, just extend shift+tab navigation to some linux
consoles (or maybe most consoles). However, there were
some consoles where shift+tab always yields just '\t'.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Since top now uses string vectors for two items in the
new focus window (cmdline & environ), there is no real
use for that 'separator' specified at toggle time. So,
this commit will find a new use for what is the space.
Henceforth, when a user is navigating using the tab or
backtab keys, should a strv element with focus contain
embedded space(s), it will be emphasized & highlighted
using the current window's message color (capclr_msg).
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
A commit that changes no code but, hopefully, helps to
better document where and how such literals were used.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This commit just brings that 'bot_focus_strv' function
up to the same standard as the vanilla 'bot_focus_str'
guy. Namely, if there is no cmdline or environ for any
process, that bottom window will now display an 'n/a'.
[ with the nature of those string vectors, it wasn't ]
[ the same simple process found for regular strings. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Some of those bottom windows grow quite large, as with
the firefox environment. If one is navigating the data
using the tab key, it can be very inconvenient when an
element should be reexamined but that focus has moved.
Therefore, this commit will support the 'back_tab' key
which is a standard combination of the shift+tab keys.
Now a user can easily backup up to any missed element,
assuming a terminal emulator honors that terminfo key.
[ a gui emulator typically will honor the 'back_tab' ]
[ terminfo string, whereas a linux console does not. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
Using 'mempcpy' was a mistake where plain old 'memcpy'
was appropriate. More importantly, the careless length
specified resulted in a SEGV under some circumstances.
[ namely, it occurred under a multi-threaded top and ]
[ the top program itself as focus + CtrlN 'environ'. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
After satisfying increased buffer size in the previous
patch, I decided to improve the highlight accuracy for
both the command lines plus the environment variables.
Since they both may contain elements which themselves
include embedded spaces, to accomplish this goal, one
must trade vanilla strings for string vectors instead.
[ at last such library items have now been justified ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
As it turns out, some of the 'environ' strings are big
enough to overrun the initial buffer sizes. And, while
no real harm was done (other than to silently truncate
the output), this patch will increase the buffer size.
While we're at it. we will normalize a few more buffer
declarations along with correcting a couple typos too.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
----------------------------------- ( minus git hash )
[ and along the way, those 2 newest namespace fields ]
[ are now mentioned under that same 'X' command part ] <=== hey, we don't got them here!
[ this commit already changed for improved response. ]
[ they should have been included in the patch below. ]
Reference(s):
commit ........................................
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
--------------------------------------------- ( none )
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
[ along the way we will restore '^R' to keys summary ]
[ plus correct a leftover reference to 'Ctrl-V' too. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This commit adds a prototype for a potential extension
of that tabbed bottom window capability. It introduces
a 'menu' which then provides for users' selections. It
does not actually do anything meaningful and will only
be enabled with the new #define called 'BOT_PICK_YES'.
[ since it's just a proof of concept, no attempt has ]
[ been made to add the usual NLS translation support ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This commit introduces the 'tab' key which can be used
to highlight individual elements in that bottom 'Ctrl'
window. This can really help when reviewing such data.
[ note, normal ongoing monitoring continues unabated ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This commit adds support for displaying the namespaces
in top's separate bottom 'Ctrl' window. Along the way,
the plumbing is now in place to extend this capability
to other data (if we don't run out of '^' keystrokes).
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
This patch will just set the stage for the next commit
where we'll be adding the capability to display things
that sometimes may necessitate multiple library items.
In that effort we will be adding several new routines.
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original newlib message
--------------------------------------------- ( none )
Signed-off-by: Jim Warner <james.warner@comcast.net>
______________________________ original commit message
----------------------------------- ( minus git hash )
In the patch referenced below the bottom 'Ctrl' window
was made to remain until it was dismissed by the user.
As such, it required abandoning a 'Cap_nl_clreos' used
when all the terminal rows had not been drawn. Instead
each line had to be cleared individually until the row
reserved for that 'Ctrl' window area had been reached.
Unfortunately, while a 'Cap_nl_clreos' didn't create a
problem for 'batch' mode, a 'Cap_clr_eol' used instead
yielded an unending loop if those rows were limitless.
So, now we will only clear that area when top isn't in
'batch' mode (which should have always been the case).
Reference(s):
. May, 2022 - bottom window made sticky
commit ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Signed-off-by: Jim Warner <james.warner@comcast.net>