top: add the ability to suppress zeros in most columns
With the increased width and precision of memory and % columns, the proliferation of 0's when there's nothing to report seems like a distraction versus useful data. This commit introduces the '0' toggle which can either display or suppress those zeros. And, like the scaling states this new state is also preserved in the rcfile. (now that we know a '.' + 2 spaces is squeezed to one) (everything's perfectly justified, but it's just luck) Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
13
top/top.c
13
top/top.c
@ -3113,8 +3113,8 @@ static void configs_read (void) {
|
||||
} // end: for (GROUPSMAX)
|
||||
|
||||
// any new addition(s) last, for older rcfiles compatibility...
|
||||
fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d\n"
|
||||
, &Rc.fixed_widest, &Rc.summ_mscale, &Rc.task_mscale);
|
||||
fscanf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n"
|
||||
, &Rc.fixed_widest, &Rc.summ_mscale, &Rc.task_mscale, &Rc.zero_suppress);
|
||||
|
||||
try_inspect_entries:
|
||||
|
||||
@ -3702,8 +3702,8 @@ static void file_writerc (void) {
|
||||
}
|
||||
|
||||
// any new addition(s) last, for older rcfiles compatibility...
|
||||
fprintf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d\n"
|
||||
, Rc.fixed_widest, Rc.summ_mscale, Rc.task_mscale);
|
||||
fprintf(fp, "Fixed_widest=%d, Summ_mscale=%d, Task_mscale=%d, Zero_suppress=%d\n"
|
||||
, Rc.fixed_widest, Rc.summ_mscale, Rc.task_mscale, Rc.zero_suppress);
|
||||
|
||||
if (Inspect.raw)
|
||||
fputs(Inspect.raw, fp);
|
||||
@ -3901,6 +3901,9 @@ static void keys_global (int ch) {
|
||||
case 'Z':
|
||||
wins_colors();
|
||||
break;
|
||||
case '0':
|
||||
Rc.zero_suppress = !Rc.zero_suppress;
|
||||
break;
|
||||
case kbd_ENTER: // these two have the effect of waking us
|
||||
case kbd_SPACE: // from 'select()', updating hotplugged
|
||||
sysinfo_refresh(1); // resources and refreshing the display
|
||||
@ -4364,7 +4367,7 @@ static void do_key (int ch) {
|
||||
} key_tab[] = {
|
||||
{ keys_global,
|
||||
{ '?', 'B', 'd', 'E', 'e', 'F', 'f', 'g', 'H', 'h'
|
||||
, 'I', 'k', 'r', 's', 'X', 'Y', 'Z'
|
||||
, 'I', 'k', 'r', 's', 'X', 'Y', 'Z', '0'
|
||||
, kbd_ENTER, kbd_SPACE, '\0' } },
|
||||
{ keys_summary,
|
||||
{ '1', 'C', 'l', 'm', 't', '\0' } },
|
||||
|
Reference in New Issue
Block a user