Skip to content

Conversation

@amir20
Copy link
Owner

@amir20 amir20 commented Nov 29, 2025

No description provided.

@amir20 amir20 enabled auto-merge (squash) November 29, 2025 17:09
@claude
Copy link

claude bot commented Nov 29, 2025

PR Review

This PR improves scrollbar positioning in the log view by using actual content and viewport lengths instead of a fixed 100-position scale.

✅ What's Good

  1. Correct scrollbar calculation: Using .content_length(num_lines) and .viewport_content_length(state.last_viewport_height) provides accurate scrollbar positioning based on actual log content
  2. Simplified logic: Removed the percentage-based workaround in favor of direct position calculation
  3. Tests updated: Snapshot tests properly reflect the new scrollbar behavior

⚠️ Potential Issue

Line 145: Scrollbar position calculation may be incorrect

.position(actual_scroll + state.last_viewport_height)

The position should typically represent the top of the viewport, not the bottom. Adding last_viewport_height to actual_scroll places the scrollbar thumb at the bottom of the visible content.

Expected behavior:

  • .position(actual_scroll) - represents where the viewport starts in the content

Current behavior:

  • .position(actual_scroll + viewport_height) - represents where the viewport ends

This might cause the scrollbar thumb to appear lower than expected, especially when scrolled to the top (actual_scroll = 0 would show position at viewport_height instead of 0).

🧪 Recommendation

Test the scrollbar visually when:

  • At the top of logs (actual_scroll = 0) - thumb should be at the top
  • At the bottom of logs (actual_scroll = max_scroll) - thumb should be at the bottom
  • In the middle - thumb should reflect relative position

If the current behavior is intentional (e.g., Ratatui's Scrollbar expects bottom position), add a comment explaining this.


Verdict: Approve with suggested verification of scrollbar position calculation.

@amir20 amir20 disabled auto-merge November 29, 2025 17:11
@github-actions
Copy link

Docker Image Built Successfully

docker pull ghcr.io/amir20/dtop:pr-163

@amir20 amir20 merged commit d5285f3 into master Nov 29, 2025
11 checks passed
@amir20 amir20 deleted the better-scroll branch November 29, 2025 17:37
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.

2 participants