Skip to content

Stable tree view#1957

Merged
BenBE merged 4 commits intohtop-dev:mainfrom
fasterit:stable-tree-view
May 3, 2026
Merged

Stable tree view#1957
BenBE merged 4 commits intohtop-dev:mainfrom
fasterit:stable-tree-view

Conversation

@fasterit
Copy link
Copy Markdown
Member

Improvements to the following function are needed to make the stable tree view make sense (otherwise it would be quite just a duplication of functionality). Hence commit #1.

The stable tree view comes in two flavors:
soft = htop tries to keep the tree view stable but does not allow blank space above the tree root (PID 0) to accommodate all possible tree refreshs
hard = htop allows blank lines above the tree root (PID 0) to keep the visual line at nearly all cost

The default is off, so retain existing jumpiness.

I did not implement a hot key for switching as I think people who like stable tree view will just switch it on and keep it that way.

Fixes #1905

@fasterit fasterit added the enhancement Extension or improvement to existing feature label Apr 12, 2026
@jtmoon79
Copy link
Copy Markdown

This is great! Should there be a command-line option?
Maybe --tree-view-stabilize with enumerated string values like stable, stable-no-blanks, off ?

@fasterit
Copy link
Copy Markdown
Member Author

I like the idea, but I added it as an optional argument to --tree. That seems easier to discover and remember.

@fasterit fasterit marked this pull request as ready for review May 2, 2026 18:20
@BenBE BenBE added this to the 3.6.0 milestone May 2, 2026
Comment thread CommandLine.c Outdated
} CommandLineSettings;

static bool parseTreeStableMode(const char* arg, int* stableTreeView) {
if (String_eq(arg, "0") || String_eq(arg, "jumpy")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (String_eq(arg, "0") || String_eq(arg, "jumpy")) {
if (String_eq(arg, "0") || String_eq(arg, "jumpy") || String_eq(arg, "legacy")) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@BenBE: How do you like "classic" ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also fine. ;-)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oki, thanks, then RTM

@fasterit fasterit force-pushed the stable-tree-view branch from 9723e0e to 214e7f3 Compare May 3, 2026 14:07
@fasterit
Copy link
Copy Markdown
Member Author

fasterit commented May 3, 2026

I would probably squash 7d7c55d into 74a3b14 before merge.

Waiting on feedback from @BenBE for the mode names.

Daniel Lange added 3 commits May 3, 2026 17:57
0 - off (default)
1 - soft (tree will jump when the followed process needs to be moved up for visual reasons)
2 - hard (tree will be allowed to be starting mid-screen as the selected line is defended to be visually stable hard)

Setting written to screen.stable_tree_view

Assisted-by: Microsoft Copilot/Claude Sonnet 4.6
…ction

* Also Alt-UP and Alt-DOWN as the Shift variants are often grabbed by the
  terminal emulators for scollback navigation
@fasterit fasterit force-pushed the stable-tree-view branch from 214e7f3 to 06849fd Compare May 3, 2026 16:00
@fasterit
Copy link
Copy Markdown
Member Author

fasterit commented May 3, 2026

Partially squashed as per #1957 (comment)

@BenBE BenBE merged commit 31b1a15 into htop-dev:main May 3, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Extension or improvement to existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix tree view jumparound once for all

3 participants