Skip to content

Page through the TUI's lists with PgUp and PgDn - #527

Merged
dhh merged 1 commit into
mainfrom
tui-page-keys-in-lists
Sep 29, 2026
Merged

dhh merged 1 commit into
mainfrom
tui-page-keys-in-lists

Conversation

@dhh

@dhh dhh commented Sep 29, 2026

Copy link
Copy Markdown
Member

PgUp and PgDn did nothing in the TUI's lists; only the journal handled them. A long Imbox could only be moved through one thread at a time.

  • The change: PgDn scrolls a list on by the window it shows, like a pager: the threads just past the bottom come up to the top, and the cursor keeps its row on screen. PgUp goes back the same way. PgDn also reads the next page in, as the down arrow does near the bottom.
  • At the ends: on the last window, PgDn moves the cursor to the last thread, and PgDn never scrolls the last thread off the bottom (lastWindowStart). On the first window, PgUp moves the cursor to the first thread.
  • Where: every mail list (boxes, labels, collections, search results, bundles, Previously Seen), both panes of The Screener, and the contact list.
  • How: posting rows vary in height because of the section headers, so contentList gets its own pageDown/pageUp built on visibleItemsFrom. The Screener and contacts have fixed-height rows and share a small pageBy helper.

docs/tui.md mentions the keys. New tests cover paging a posting list both ways, stopping at the ends, a list shorter than the window, pageBy's cases, and the keys reaching the list through the mail view.

🤖 Generated with Claude Code

@dhh
dhh requested a review from a team as a code owner September 29, 2026 19:29
Copilot AI balanced review requested due to automatic review settings September 29, 2026 19:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Section headers currently cause the cursor to shift screen rows, contrary to the documented paging behavior.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds PgUp/PgDn navigation to paginated TUI lists.

Changes:

  • Implements page-wise navigation for mail, Screener, and contact lists.
  • Preserves pagination loading behavior.
  • Adds tests and TUI documentation.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
internal/​tui/​content.go Adds paging algorithms.
internal/​tui/​mail.go Routes page keys across mail lists.
internal/​tui/​screener.go Adds Screener paging.
internal/​tui/​contacts.go Routes contact-list page keys.
internal/​tui/​contacts_list.go Adds contact paging methods.
internal/​tui/​tui_test.go Tests paging behavior and routing.
docs/​tui.md Documents page keys.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/tui/content.go
Comment on lines +436 to +442
row := c.cursor - c.scrollOff
scrollOff := min(c.scrollOff+c.visibleItemsFrom(c.scrollOff), c.lastWindowStart())
if scrollOff <= c.scrollOff {
c.cursor = count - 1
} else {
c.scrollOff = scrollOff
c.cursor = min(scrollOff+row, count-1)
Comment thread docs/tui.md
Comment on lines +35 to +36
PgUp and PgDn move a screen at a time through any list — a box, a search, a bundle, The
Screener or your contacts — keeping the cursor on the same row of the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhh
dhh force-pushed the tui-page-keys-in-lists branch from 489c80f to e176300 Compare September 29, 2026 20:10
@dhh
dhh merged commit 037cab2 into main Sep 29, 2026
25 checks passed
@dhh
dhh deleted the tui-page-keys-in-lists branch September 29, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants