Skip to content

Open a thread on its latest message - #524

Merged
dhh merged 1 commit into
mainfrom
tui-open-thread-on-latest-message
Sep 29, 2026
Merged

dhh merged 1 commit into
mainfrom
tui-open-thread-on-latest-message

Conversation

@dhh

@dhh dhh commented Sep 29, 2026

Copy link
Copy Markdown
Member

A thread in the TUI used to open at its top, so on a long conversation the reader had to scroll past everything they'd already read to reach the reply that brought them there.

  • The change: a thread now opens with its latest message's header at the top of the screen (showLatestEntry in internal/tui/mail.go). k steps back through earlier messages and j forward again. If the last message is short, the end of the one above it shows too, because the viewport can't scroll past the end of the thread.
  • Why the latest and not the first unread: nothing HEY serves says which messages in a thread the reader hasn't seen. Entries carry no read state, and the posting's seen covers the thread as a whole. The latest message is where new mail arrives. Opening on the first unread would need HEY and the SDK to expose per-entry read state.

docs/tui.md gets one line. A new test opens a three-message thread through topicLoadedMsg and checks it lands on the last message, with k going back one.

🤖 Generated with Claude Code

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

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

🟢 Approved

The focused implementation, tests, and documentation consistently support the intended navigation behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Updates the TUI to open threads at their newest message, reducing unnecessary scrolling.

Changes:

  • Positions the thread viewport at the latest entry.
  • Tests latest-entry opening and backward navigation.
  • Documents j/k message navigation.

[!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/​mail.go Opens threads at the newest entry offset.
internal/​tui/​mail_test.go Verifies initial position and k navigation.
docs/​tui.md Documents the updated behavior.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhh
dhh force-pushed the tui-open-thread-on-latest-message branch from a65d44c to f12d108 Compare September 29, 2026 19:53
@dhh
dhh merged commit ad2cf85 into main Sep 29, 2026
25 checks passed
@dhh
dhh deleted the tui-open-thread-on-latest-message branch September 29, 2026 19:56
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