Skip to content

Scroll a dashboard taller than the pane, with a scrollbar - #19

Merged
shayan-ys merged 2 commits into
mainfrom
feat/scroll
Oct 9, 2026
Merged

shayan-ys merged 2 commits into
mainfrom
feat/scroll

Conversation

@shayan-ys

@shayan-ys shayan-ys commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

What and why

On a short pane, watch mode cut off every row past the bottom with … N more rows. Watch mode draws on the terminal's full-screen view, which has no scrollback, and drawing inline can't redraw a frame taller than the pane without piling stale copies into scrollback. So devdash now scrolls inside the app, the way less and htop do.

  • up/down scroll one row. These are new built-in keys, keys.scroll_up and keys.scroll_down, and can be remapped or disabled like the other built-ins. An integration that binds up or down now fails config validation with the existing remap hint.
  • The mouse wheel scrolls too. On the full-screen view, most terminals send arrow keys for the wheel. devdash also turns on alternate scroll mode (DEC 1007) while it runs, then restores the previous setting with XTSAVE/XTRESTORE. It writes these sequences only when stdout is a terminal, and restores the mode even if restoring stdin fails.
  • A scrollbar in the rightmost column shows which part is on screen. When the content overflows, the dashboard and its integrations lay out one column narrower to make room for it.
  • Each frame reads the scroll offset once and re-checks overflow after the narrower layout, so a key press or a data refresh between those steps can't misalign the scrollbar.
  • The footer lists the scroll keys only when the content overflows. --once now renders without a viewport, so it prints every row (it used to stop at a 10,000-row height).

Checklist

  • uv run pytest and uv run ruff check . pass (116 passed; ruff clean)
  • A test covers new behavior that a plausible bug could break (test_a_dashboard_taller_than_the_pane_scrolls_with_its_keys_within_bounds: thumb position at both ends, scrolling stops at both ends, narrower layout width, --once prints every row)
  • CHANGELOG.md has a line under Unreleased for a user-visible change
  • The README image is regenerated if the pane looks different: not needed, because the screenshot is taller than its content and shows no scrollbar. Regenerating it shows a one-row drift that already exists on main, so it stays out of this PR.

Verification

  • Ran the real app in a 70×20 pty, rendered with pyte. It starts with the thumb at the top; 30 wheel-style ESC O B presses scroll the content and move the thumb down. On quit, the output contains the 1007 save, set and restore sequences.
  • Rendered panes 1 to 3 rows tall without errors; --once printed all 77 rows of a real dashboard.
  • CI is green on ubuntu and macOS with Python 3.12, 3.13 and 3.14.

Review

  • Review path: material, agent code review, because the new built-in keys change the public config contract. CodeRabbit is not installed on this repository. No optional reviews were run.
  • Accepted and fixed in e0d047b: the scroll offset race between the key loop and the render thread; overflow decided from a different snapshot than the one drawn; mode 1007 setup outside the cleanup scope; escapes written to redirected stdout; --once cropping past 9,998 rows.
  • Declined: the width feedback loop never settling. The narrower layout only adds wrapped rows, so content that overflows at width W also overflows at W−1, and the width settles after one change. Only an integration that prints fewer rows when given fewer columns could make it flip back and forth.
  • Remaining non-blocking findings: none.

Watch mode draws on the full-screen view, which has no scrollback, so rows past the pane were cut off. up/down (keys.scroll_up, keys.scroll_down) scroll one row; the mouse wheel sends those keys on the full-screen view, and devdash turns on alternate scroll mode (DEC 1007) while it runs. A scrollbar in the rightmost column shows the visible part; content lays out one column narrower beside it.
@shayan-ys

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@shayan-ys
shayan-ys marked this pull request as ready for review October 9, 2026 20:04
@shayan-ys
shayan-ys marked this pull request as draft October 9, 2026 20:05
…arded mode 1007

Render reads st.scroll once and re-checks overflow after the narrow layout, so a key press or data change between steps cannot misalign the scrollbar. --once renders without a viewport instead of a 10,000-row height. Mode 1007 is written only to a terminal, inside the cleanup scope, and restored even if restoring stdin fails.
@shayan-ys
shayan-ys marked this pull request as ready for review October 9, 2026 20:08
@shayan-ys
shayan-ys merged commit 5fe3122 into main Oct 9, 2026
6 checks passed
@shayan-ys
shayan-ys deleted the feat/scroll branch October 9, 2026 20:09
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