Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added keybind 'N' for sorting by PID #413

Closed
wants to merge 28 commits into from
Closed

Added keybind 'N' for sorting by PID #413

wants to merge 28 commits into from

Conversation

jakem72360
Copy link

N key was selected, as it seems to be free and is backwards compatible with top.

Action.c Outdated
Comment on lines 453 to 472
{ .key = " Arrows: ", .info = "scroll process list" },
{ .key = " Digits: ", .info = "incremental PID search" },
{ .key = " F3 /: ", .info = "incremental name search" },
{ .key = " F4 \\: ",.info = "incremental name filtering" },
{ .key = " F5 t: ", .info = "tree view" },
{ .key = " p: ", .info = "toggle program path" },
{ .key = " m: ", .info = "toggle merged command" },
{ .key = " Z: ", .info = "pause/resume process updates" },
{ .key = " u: ", .info = "show processes of a single user" },
{ .key = " H: ", .info = "hide/show user process threads" },
{ .key = " K: ", .info = "hide/show kernel threads" },
{ .key = " F: ", .info = "cursor follows process" },
{ .key = " + -: ", .info = "expand/collapse tree" },
{ .key = " P M T: ", .info = "sort by CPU%, MEM% or TIME" },
{ .key = " I: ", .info = "invert sort order" },
{ .key = " F6 > .: ", .info = "select sort column" },
{ .key = " Arrows: ", .info = "scroll process list" },
{ .key = " Digits: ", .info = "incremental PID search" },
{ .key = " F3 /: ", .info = "incremental name search" },
{ .key = " F4 \\: ",.info = "incremental name filtering" },
{ .key = " F5 t: ", .info = "tree view" },
{ .key = " p: ", .info = "toggle program path" },
{ .key = " m: ", .info = "toggle merged command" },
{ .key = " Z: ", .info = "pause/resume process updates" },
{ .key = " u: ", .info = "show processes of a single user" },
{ .key = " H: ", .info = "hide/show user process threads" },
{ .key = " K: ", .info = "hide/show kernel threads" },
{ .key = " F: ", .info = "cursor follows process" },
{ .key = " F6 + -: ", .info = "expand/collapse tree" },
{ .key = " N P M T: ", .info = "sort by PID, CPU%, MEM% or TIME" },
{ .key = " I: ", .info = "invert sort order" },
{ .key = " F6 > .: ", .info = "select sort column" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resizing the key column causes too much unnecessary noise in the patch.

Action.c Outdated
Comment on lines 567 to 578
mvaddstr(line + item, 9, helpLeft[item].info);
mvaddstr(line + item, 10, helpLeft[item].info);
attrset(CRT_colors[HELP_BOLD]);
mvaddstr(line + item, 0, helpLeft[item].key);
if (String_eq(helpLeft[item].key, " H: ")) {
if (String_eq(helpLeft[item].key, " H: ")) {
attrset(CRT_colors[PROCESS_THREAD]);
mvaddstr(line + item, 32, "threads");
} else if (String_eq(helpLeft[item].key, " K: ")) {
mvaddstr(line + item, 33, "threads");
} else if (String_eq(helpLeft[item].key, " K: ")) {
attrset(CRT_colors[PROCESS_THREAD]);
mvaddstr(line + item, 26, "threads");
mvaddstr(line + item, 27, "threads");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Further resize-related noise.

Comment on lines -582 to +587
mvaddstr(line + item, 40, helpRight[item].key);
mvaddstr(line + item, 41, helpRight[item].key);
attrset(CRT_colors[DEFAULT_COLOR]);
mvaddstr(line + item, 49, helpRight[item].info);
mvaddstr(line + item, 50, helpRight[item].info);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito.

Action.c Outdated
{ .key = " H: ", .info = "hide/show user process threads" },
{ .key = " K: ", .info = "hide/show kernel threads" },
{ .key = " F: ", .info = "cursor follows process" },
{ .key = " F6 + -: ", .info = "expand/collapse tree" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F6 is no more.

@jakem72360
Copy link
Author

What would your suggestion be? Adding the keybind to key in helpLeft would violate the leading space. Adding more padding causes the info section of the line to be cut off. Hardcoding coordinates is flimsy in general, and this seemed like the most logical solution.

I'm happy to change the patch, and am open to suggestions...

@BenBE
Copy link
Member

BenBE commented Dec 20, 2020

Instead of adding spaces everywhere I think it'd be less noise, if just the horizontal offset of everything was shifted to the right by one. The entry you need to actually update has two spaces at the front, thus you could fit it in there.

An alternative was to split the PMT line entirely (One function per line) and shuffle things from the left to the right (or vice versa) and add the N shortcut in a second commit.

@jakem72360
Copy link
Author

I've updated it with changes only to the hardcoded X positions. I had assumed the leading spaces were desired, as they were present in both arrays.

Regarding splitting the sort functions onto multiple lines, I'll leave that decision to you. I think it looks better being one character wider, than a column being three lines longer. But like I said, it's up to you.

cgzones and others added 9 commits December 20, 2020 17:01
Draw the FunctionBar within Panel_draw instead of manually throughout
the code.
Add an optional PanelClass function drawFunctionBar, to allow specific
panels to override the default FunctionBar_draw call.
Rework the code on color change, to really change all colors (selection
markers and panel headers).

Closes: #402
- drop unused kinfo includes and link argument
- detect kvm library necessity at configure step
- fix variable typo
- move some functions to file scope
- drop unused global variable
@fasterit
Copy link
Member

see Action.c a bit below your inserted line:

   keys['n'] = actionIncNext;
   keys['N'] = actionIncPrev;

Either we remove these bindings or we need to find something else to map to PID sorting.

@fasterit fasterit added this to the 3.0.5 milestone Dec 22, 2020
@jakem72360
Copy link
Author

I just noticed that. What do you think is best? If we remove the original bindings, we can preserve some compatibility with top. If we keep those bindings, I'd suggest the D key as it's the only letter in PID not already in use. For now, I'll update the PR with the D binding.

@fasterit
Copy link
Member

fasterit commented Dec 23, 2020

I just noticed that. What do you think is best?

I think we should remove the old n / N bindings and the stale code they call.
I asked on IRC what fellow devs think about this. That would free the "N" key then for PID sorting.
o/ DLange

@jakem72360
Copy link
Author

I think we should remove the old n / N bindings and the stale code they call.
I asked on IRC what fellow devs think about this. That would free the "N" key then for PID sorting.
o/ DLange

Created #425 with proposal for code removal

@fasterit
Copy link
Member

Merged the patch (fixed back to using the N key) in the series up to f1463fd.

Thank you very much!

@fasterit fasterit closed this Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants