agavra/tuicr PR #511 — Scrollable error viewer — PR #511
agavra/tuicr · pull request #511 ·
Transcript
PlainEnglish
Let's walk through pull request five eleven, which adds a scrollable error viewer to the tuicr terminal UI. This is a focused enhancement touching twelve files with about four hundred lines added.
PlainEnglish
Here's what we're building. The primary goal is a full-screen scrollable viewer for error details. We're also surfacing PR list loading errors that were previously silent, and enabling command mode access from the commit-select screen. One key constraint: overlay state must be preserved so users can navigate back to where they were.
PlainEnglish
Users were hitting errors from GitHub and GitLab API calls that got truncated in the single-line status bar. Long error messages, especially detailed JSON responses, were impossible to read when they got cut off. Even worse, some errors like PR list loading failures were just swallowed silently. This PR fixes that by giving users a dedicated space to inspect the full error, just like the existing help overlay.
Architecture
Let's trace the changes. First, we add a new input mode called MessageDetails to the enum. This represents the full-screen error viewer, similar to how Help is a dedicated overlay mode.
Architecture
Here's the rendering function for message details. It creates a bordered full-screen block, grabs the current error message, wraps it to the viewport width, and clamps the scroll offset so you can navigate through long errors with j and k keys. The UI reuses the same scroll state as the help overlay for consistency.
Architecture
The change touches seven main areas. We register the messages command in the handler, map its keybindings to reuse help navigation, add the rendering function in help popup, update the status bar to advertise the new command, wire the full-screen check into app layout, refactor mode transitions to preserve overlay state, and surface PR loading errors that were previously silent.
Architecture
Here's the key refactor. Instead of always returning to Normal mode when you close help, we now track where you came from in overlay return mode. When you open help or message details, we save the current mode. When you close the overlay, we restore that saved mode. This lets overlays stack correctly, so you can open message details from commit-select and get back to commit-select when you press q.
Architecture
And here's where we fix the silent errors. Before, when PR list loading failed, the error just got swallowed during apply initial load or apply load more. Now we capture any error before applying the result, and if there was an error, we call set error to surface it in the message bar. That way users can run colon messages to see the full API response.
Architecture
One nice touch: for error messages, the status bar now prepends a hint that says colon messages in brackets, so users immediately know they can inspect the full error. The message content itself gets newlines replaced with spaces to keep the status bar single-line.
Architecture
One more quality-of-life change: the colon key now works in commit-select mode to enter command mode. That means you can run colon messages even when you're browsing PRs in the selector, making the error viewer accessible from more places in the UI.
PlainEnglish
After this lands, users get full visibility into errors. Press colon messages to open a scrollable full-screen view, navigate with j and k just like help, and when you press q or escape, you're back exactly where you were. PR loading errors that were silent before now surface to the message bar where you can inspect them.
CodeQuality
There are a few things to keep an eye on. The most theoretical concern is if someone manually sets input mode to message details without initializing overlay return mode, you could end up in the wrong mode on exit. That's unlikely since normal code paths all use open message details, which does the right thing. The second item is a resize race: if the terminal gets resized between calculating line count and clamping scroll offset, you might not be able to reach content at the new smaller viewport. And the third one is intentional but could surprise users: if a warning or info message arrives while you're scrolling through an error, message details closes automatically.
PlainEnglish
This is a solid usability improvement. The implementation is clean, the overlay state tracking is consistent, and the tests cover the key workflows. I'd approve with a couple of notes: confirm the resize behavior in a narrow terminal, and maybe consider deferring the auto-close if the user has actively scrolled, so background messages don't kick them out mid-read. Nice work on this one.
How this was made
Lenzon read agavra/tuicr at pull request #511 and generated this walkthrough automatically. The narration above is the transcript of what it says.
Explain a pull request from your own repo
Point Lenzon at a repo or a pull request and get a narrated walkthrough like this one.
Try it