Skip to content

Preview a sender's email in The Screener with space - #529

Merged
dhh merged 3 commits into
mainfrom
tui-screener-preview
Sep 29, 2026
Merged

dhh merged 3 commits into
mainfrom
tui-screener-preview

Conversation

@dhh

@dhh dhh commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

A row in The Screener only has room for the subject and the first line of what the sender wrote, which often isn't enough to decide. Space now opens a bigger preview.

  • The preview: it shows the sender's most recent email in full, rendered the way a thread renders a body: name and address, date and subject at the top, the Markdown body below in a scrolling viewport. It covers the queue while it's open.
  • Keys: arrow keys, j/k and PgUp/PgDn scroll it. y/i and n answer for the sender being previewed and close it. Space, Escape and q close it and leave you in The Screener. The help bar changes to match, and the queue's help bar offers "space preview".
  • Reading: one Messages().Get of the clearance's most_recent_entry (the row now keeps entryID). It only reads, so it doesn't screen the sender or tell them anything. I checked against a live account: a still-unscreened sender's email reads in full, and the Screener still held the same four senders afterwards.
  • Edge cases:
    • A slow answer for a preview the reader already closed is dropped, using a request id as the other lanes do.
    • A sender HEY served no entry for gets a notice instead of an empty preview.
    • Screener History has decisions, not emails, so space does nothing there.
    • The body is rendered again when the width or the theme changes.
    • The header is cut to the screen width before it's styled, keeping room for the date, so a long name or address can't wrap and push the footer off screen. Found in review.
  • Refactor: screen now calls a new screenRow, so an answer from the preview goes to the previewed sender, not to whoever a live re-read has since put under the cursor.

docs/tui.md describes it. New tests cover opening, the three ways to close, answering from the preview, a late answer after closing, a sender with nothing to preview, the history tab, and scrolling with the header in place.

🤖 Generated with Claude Code

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

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

Theme refresh and narrow-header layout defects can leave the preview incorrectly rendered.

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

Open (3)
What changed in this PR

Adds full-message previews to The Screener so users can review an email before screening its sender.

Changes:

  • Adds preview loading, rendering, scrolling, closing, and screening controls.
  • Preserves sender identity during live queue refreshes.
  • 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/​screener.go Integrates preview state and controls.
internal/​tui/​screener_preview.go Implements preview loading and rendering.
internal/​tui/​screener_test.go Adds preview API fixture.
internal/​tui/​screener_preview_test.go Tests preview behavior and edge cases.
docs/​tui.md Documents preview controls.

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

Comment thread internal/tui/screener.go
Comment on lines +258 to +260
func (v *screenerView) Restyle() {
if v.preview != nil {
v.preview.width = 0
Comment thread internal/tui/screener_preview.go Outdated
Comment on lines +140 to +143
b.WriteString(truncateStr(" "+name, width))
if row.trailing != "" {
b.WriteString(styleMuted.Render(" " + row.trailing))
}
Comment thread docs/tui.md

Space opens a bigger preview of the selected sender's most recent email: the whole message,
not just the first line the list has room for. Arrow keys and PgUp/PgDn scroll it, `y` and
`n` answer for that sender straight from it, and Space or Escape closes it again. Opening a
dhh and others added 2 commits September 29, 2026 22:13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhh
dhh force-pushed the tui-screener-preview branch from f01312f to 218f107 Compare September 29, 2026 20:14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhh
dhh merged commit 429233f into main Sep 29, 2026
25 checks passed
@dhh
dhh deleted the tui-screener-preview branch September 29, 2026 20:18
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