Add single-file mode and fix annotation input width#10
Merged
Conversation
Skip tree pane entirely when singleFile is set, giving the diff pane full terminal width. handleResize sets treeWidth=0 and diffContentWidth returns width-3 in single-file mode.
feat: verify acceptance criteria for single-file mode
fix: address code smell findings fix: address code review findings fix: address codex review findings
Use diffContentWidth instead of arbitrary offset to calculate textinput width, preventing cursor from extending past the pane border.
There was a problem hiding this comment.
Pull request overview
This PR improves the TUI layout and key handling by introducing an automatic “single-file mode” (hide the tree when only one file is present) and by fixing annotation input sizing to align with the actual diff content width.
Changes:
- Add
singleFilemode detection (exactly one changed file) and render the diff pane at full terminal width while hiding the tree. - Make pane-switching and file-navigation actions no-ops in single-file mode while preserving
n/Nsearch navigation when matches exist. - Fix annotation text input width to be derived from
diffContentWidth()instead of an arbitrary offset, preventing overflow past the pane border.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ui/model.go | Adds singleFile state, adjusts resize/layout rendering, and disables tree-related navigation in single-file mode. |
| ui/model_test.go | Adds unit tests covering single-file mode behavior (layout, resize behavior, key no-ops, and search navigation). |
| ui/diffview.go | Updates diffContentWidth() to correctly compute content width in single-file mode. |
| ui/annotate.go | Uses diffContentWidth() to size annotation input consistently with the diff pane content width. |
| README.md | Documents the new single-file auto-detection behavior. |
| docs/plans/completed/20260403-single-file-mode.md | Adds an implementation plan/write-up for the completed feature. |
| CLAUDE.md | Documents the single-file mode behavior and invariants for contributors. |
| .claude-plugin/skills/revdiff/references/usage.md | Updates usage docs to mention single-file mode and key behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ui/model_test.go
Outdated
| assert.Equal(t, 1, model.searchCursor, "n should advance search cursor in single-file mode") | ||
| assert.Equal(t, 2, model.diffCursor, "cursor should move to second match") | ||
|
|
||
| // n should navigate to previous search match |
There was a problem hiding this comment.
Test comment says n navigates to the previous search match, but the test actually sends N. Update the comment to match the key being exercised to avoid confusion when reading/failing this test.
Suggested change
| // n should navigate to previous search match | |
| // N should navigate to previous search match |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary