Skip to content

Harden horizontal scroll offsets - #2103

Open
fasterit wants to merge 1 commit into
htop-dev:mainfrom
fasterit:scroll-hardening
Open

Harden horizontal scroll offsets#2103
fasterit wants to merge 1 commit into
htop-dev:mainfrom
fasterit:scroll-hardening

Conversation

@fasterit

@fasterit fasterit commented Sep 10, 2026

Copy link
Copy Markdown
Member

Spliced out from #2099

This makes htop only scroll right if there is something to scroll right to.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 892d8589-9adb-4a67-8760-a76f8679006a

📥 Commits

Reviewing files that changed from the base of the PR and between b9a2a63 and e385e20.

📒 Files selected for processing (1)
  • Panel.c

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Panel_onKey now clamps horizontal scrolling after left and right movement. Left movement cannot set scrollH below zero. Right movement cannot set scrollH above the selected text width minus the panel width.

Suggested reviewers: germanaizek

Severity of issue fixed: Low

Merge Risk: 🟡 Moderate · up to e385e

Right-arrow navigation can overflow or calculate an incorrect horizontal bound for exceptionally large rendered values because the offset is incremented before clamping. The arithmetic should be made overflow-safe before merge.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Left scroll stops at zero
Right scroll meets the text
The panel holds its bounds
No blank space lies ahead
Keys move with measured steps

Comment @coderabbitai help to get the list of available commands.

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.

1 participant