fix(review): show diff colors on non-truecolor terminals, fix tab indentation, add commit picker - #29
Merged
Merged
Conversation
…indentation
The diff view emitted 24-bit truecolor for every syntax color and diff
background. Terminals that drop truecolor escapes — tmux and macOS
Terminal.app unless specially configured — rendered the diff as plain,
uncolored text, which reads as "missing syntax highlighting". Detect the
terminal color depth and downsample RGB to the 256-color palette when
truecolor isn't reliably supported (new src/ui/review/color.rs).
Tabs collapsed to a single cell, breaking indentation. Expand them to
tab-stop-aligned spaces in the diff view.
Rework the in-TUI scope switcher into a clearer menu (uncommitted /
branch / branch+worktree) and add a commit picker: review a single
commit, or mark two commits to review the range between them.
New [review] config: truecolor ("auto" | "always" | "never") and
tab_width. Docs updated in docs/review.md.
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.
Why
gx reviewhad two rendering bugs that made the diff hard to read, and the scope switcher was incomplete:38;2;R;G;B) for every syntax color and every add/remove background. Terminals that drop truecolor escapes — tmux and macOS Terminal.app unless specially configured forRGB/Tc— silently ignored them, so the diff rendered as plain, uncolored text. (Highlighting was working; the terminal just never saw the colors.)sswitcher (branch / +worktree / uncommitted) but no way to pick a specific commit or range, and it was under-discovered.What changed
src/ui/review/color.rs): detect whether the terminal reliably supports truecolor, and downsample every RGB color (syntax foregrounds + diff palette) to the nearest xterm-256 index otherwise. Conservative auto-detection treats tmux/screen as 256-color unlesstruecolor = "always".tab_width-aligned spaces in the diff (byte offsets stay aligned so word-level emphasis is unaffected).smenu (uncommitted · all branch changes · branch + working tree) plus a commit picker —⏎reviews one commit,spacemarks a range endpoint to reviewolder^..newer. Each scope keeps its own comments. Discoverable via the empty-state hint, help bar, and help overlay.[review] truecolor(auto/always/never) andtab_width(default 4). Documented indocs/review.md.Testing
cargo test --bin gx— 266 pass (incl. new color-downsampling and tab-expansion tests);cargo clippyclean.38;2;…truecolor (dropped by tmux); after emits38;5;N/48;5;N256-color that tmux renders. Verified tab-indented lines now align with space-indented ones via a rendered-buffer dump. Smoke-tested the commit picker end-to-end (no panic).