Skip to content

Introduce screen tabs #780

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

Merged
merged 8 commits into from
Dec 8, 2021
Merged

Introduce screen tabs #780

merged 8 commits into from
Dec 8, 2021

Conversation

natoscott
Copy link
Member

This is a forward port (by nathans) of Hisham's original code.

@natoscott natoscott added the new feature Completely new feature label Sep 7, 2021
@natoscott natoscott added this to the 3.1.0 milestone Sep 7, 2021
@lgtm-com
Copy link

lgtm-com bot commented Sep 7, 2021

This pull request introduces 1 alert when merging e781d95 into a516e08 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@lgtm-com
Copy link

lgtm-com bot commented Sep 7, 2021

This pull request introduces 1 alert when merging 11f453a into a516e08 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@smalinux
Copy link
Contributor

smalinux commented Sep 8, 2021

Great work as usual, @natoscott :)

Bug 1) missing mouse handling
Settings > Screens, then choose any of them using the mouse, Htop will panic.

Bug 2) htoprc & settings related (I think!)
Try to re-order any of the "Active Columns" or just click on any of them.
then exit from Htop. re-open Htop. Will duplicate the tabs that already exist.

@natoscott natoscott force-pushed the tabs branch 4 times, most recently from 074e4a4 to 4717923 Compare September 8, 2021 03:07
@natoscott
Copy link
Member Author

Bug 1) missing mouse handling
Bug 2) htoprc & settings related (I think!)

Thanks @smalinux - these issues should be resolved now with that last git push.

Settings.c Outdated
String_freeArray(ids);
}

ScreenSettings* Settings_newScreen(Settings* this, const char* name, const char* line) {
ScreenSettings* ss = xCalloc(sizeof(ScreenSettings), 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this pointer didn't free properly. I will try to debug this later,
ASan output:

==195406==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f4adc282dc6 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6)
    #1 0x559095bdcb64 in xCalloc /home/smalinux/htop/XUtils.c:55
    #2 0x559095bd3546 in Settings_newScreen /home/smalinux/htop/Settings.c:266
    #3 0x559095bd38dd in Settings_defaultScreens /home/smalinux/htop/Settings.c:289
    #4 0x559095bd3b2b in Settings_defaultScreens /home/smalinux/htop/Settings.c:285
    #5 0x559095bd3b2b in Settings_read /home/smalinux/htop/Settings.c:328
    #6 0x559095bd7fbc in Settings_new /home/smalinux/htop/Settings.c:732
    #7 0x559095b9f988 in CommandLine_run /home/smalinux/htop/CommandLine.c:303
    #8 0x7f4adbdc30b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: 40 byte(s) leaked in 1 allocation(s).

Copy link
Member

Choose a reason for hiding this comment

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

xCalloc like calloc takes the number of elements first and the size of each element as second. Mostly a side-note, but having them swapped may lead to unnecessary trouble down the line.

That's most likely not the bug you're chasing, but you're advised to fix it while at it. ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

@smalinux thanks, I have a fix now - will push shortly.

@natoscott
Copy link
Member Author

Previous few commits from @smalinux address the final remaining feedback items (incl. defaulting to tabs disabled on upgrade). If there's other areas for improvement let us know please otherwise we'll go ahead and merge soon - thanks!

hishamhm and others added 7 commits December 7, 2021 17:04
This is a forward port (by nathans) of Hisham's original code.
If the new htop is configured with htoprc having no tabs (eg on upgrade)
then the interface will not automatically introduce/enable them.
However, for a fresh install of htop, enabling them automatically

Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Also tidy up the calloc call parameters in the initial allocation
of this pointer, thanks to @BenBE for noticing.
@natoscott natoscott merged commit 0e58784 into htop-dev:main Dec 8, 2021
@natoscott natoscott deleted the tabs branch December 8, 2021 02:11
@hishamhm
Copy link
Member

@natoscott Yay, I was thinking about that branch the other day and just learned about this work! Thank you so much! ❤️

(I just learned about this by clicking through from your post on the GSoC mailing list — clearly my Github notifications are a lost cause!)

@@ -714,4 +756,6 @@ void Action_setBindings(Htop_Action* keys) {
keys[KEY_F(10)] = actionQuit;
keys[KEY_F(18)] = actionExpandCollapseOrSortColumn;
keys[KEY_RECLICK] = actionExpandOrCollapse;
keys[KEY_SHIFT_TAB] = actionPrevScreen;
Copy link
Contributor

Choose a reason for hiding this comment

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

This key is Ctrl+F9
See [Function Keys]

Copy link
Member

Choose a reason for hiding this comment

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

May be on AIX. Which is the documentation you are referring to. On Linux it is Shift-TAB and that works as you can easily test yourself.

smalinux added a commit to smalinux/htop that referenced this pull request Apr 4, 2022
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
smalinux added a commit to smalinux/htop that referenced this pull request Apr 8, 2022
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Completely new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants