feat(tui): add configurable diff backgrounds - #1
Conversation
…e keys Add configurable TUI diff line backgrounds so users can keep syntax-theme-aware highlighting while controlling add/delete background intensity, and simplify custom overrides to one add/delete pair because there is no separate runtime dark/light override switch. Changes: - Add `tui.diff_background` mode in config (`auto`, `off`, `theme`, `custom`) with schema/docs coverage. - Add unified custom override keys `tui.diff_add_bg` and `tui.diff_del_bg` (`#RRGGBB`) and remove dark/light-split custom key usage. - Plumb new config fields from `ConfigToml` into runtime `Config` (`tui_diff_background`, `tui_diff_add_bg`, `tui_diff_del_bg`). - Add config deserialization/default tests for the new TUI fields. - Add theme-scope background lookup support in highlight rendering (`markup.inserted`/`markup.deleted` with `diff.*` fallback). - Add diff renderer background resolution by mode: keep existing adaptive defaults (`auto`), disable line background (`off`), derive from active theme scopes (`theme`), or use user colors with palette-aware quantization (`custom`). - Initialize diff renderer settings at TUI startup from loaded config. - Update `docs/config.md` with mode explanations and example custom values. - Regenerate `core/config.schema.json`. Behavioral effect: - Users can reduce bright add/delete backgrounds without replacing the entire theme by setting custom diff backgrounds, disable diff backgrounds entirely, or inherit add/delete backgrounds from their active `.tmTheme` scopes. Tests: - `cd codex-rs && just write-config-schema` - `cd codex-rs && just fmt` - `cd codex-rs && cargo test -p codex-core` - `cd codex-rs && cargo test -p codex-tui`
Summary of ChangesHello @ignatremizov, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Terminal User Interface (TUI) by introducing highly customizable diff background rendering, allowing users to tailor their visual experience for code changes. Beyond visual improvements, it refines agent memory management with new configuration options for memory retention and improves sub-agent spawning by enabling history forking, ensuring better context transfer. Additionally, the changes include more detailed logging for internal tool calls and improved markdown rendering for file links, contributing to a more robust and user-friendly development environment. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new feature for configurable diff backgrounds in the TUI. It adds new configuration options tui.diff_background, tui.diff_add_bg, and tui.diff_del_bg to control the appearance of diffs. The implementation involves changes to the configuration schema, core config structs, and the TUI rendering logic. The documentation has also been updated accordingly.
My review focuses on the implementation details. I've suggested a couple of refactorings to improve code clarity and reduce duplication in the rendering logic. Overall, the changes are well-implemented and the new feature is a great addition.
Combine the DiffBackgroundMode::Theme and DiffBackgroundMode::Custom branches in resolve_line_backgrounds by selecting RGB sources once and sharing the same quantize/fallback path. This reduces duplication while preserving behavior for off/auto/theme/custom modes.
…okup Acquire the read guard once in scope_background_rgb and reuse it for style lookup. Preserve poisoned lock recovery while removing duplicated lock-branch highlighter logic.
721df88 to
460ef45
Compare
2f4e30f to
648cdee
Compare
62994a2 to
6c10c1b
Compare
831949f to
5f3c160
Compare
33e7dd2 to
cd74070
Compare
235a080 to
39dcc87
Compare
a76cc7e to
4ed0a15
Compare
## Stack 1. [1 of 3] Support long raw TUI goal objectives - openai#27508 2. [2 of 3] Support long pasted text in TUI goals - openai#27509 3. **[3 of 3] Support images in TUI goals** - this PR ## Why The first two PRs make goal definitions resilient to long text, but `/goal` still dropped image inputs from the composer. That meant a user could attach images while defining a goal and the resulting goal continuation would not have any useful reference to those images. Goal state still persists only objective text, so image inputs need to become paths or URLs that the agent can read later. ## What Changed - Extends TUI `GoalDraft` with local image attachments and remote image URLs. - Copies local goal images through the app-server filesystem layer into the managed goal attachment directory, then rewrites active image placeholders to file references. - Appends unplaced local images and remote image URLs to the objective as referenced image files or URLs. - Preserves goal image metadata through live `/goal` submission and queued `/goal` dispatch. ## Verification - Added goal materialization coverage for local image files and remote image URLs. - Added/updated TUI slash-command coverage showing `/goal` drafts include attached images instead of dropping them. ## Manual Testing - Attached an image by bracketed-pasting its local path into a live `/goal` composer. The `[Image #1]` placeholder became a server-host `image-1.png` reference, copied bytes matched exactly, and no attachment was written under the TUI's local home. - Deleted an image placeholder before submitting a small goal and verified no image was copied. - Attached PNG and JPEG files to the same goal. Placeholder order was preserved as `image-1.png` and `image-2.jpg`, and both remote copies matched their source bytes. - Tried extensionless, malformed-extension, and extension/content-mismatched paths; the composer rejected them as image attachments before goal dispatch rather than creating misleading managed image files. - Combined a local image, a large pasted block, and enough raw text to exceed 4,000 characters. The remote attachment directory contained the image, paste sidecar, and `goal-objective.md`; all embedded references used server-host paths and both payloads matched their sources. - Submitted an image replacement while a goal was active, verified no image was copied before confirmation, then canceled and confirmed the attachment count was unchanged.
056c22a to
9286dca
Compare
6d00ee1 to
3486f67
Compare
d47deee to
5feb52b
Compare
f48ed25 to
4c1d038
Compare
Summary
tui.diff_backgroundwith modes:auto,off,theme, andcustomtui.diff_add_bg/tui.diff_del_bg(single pair, no dark/light split)markup.inserted/markup.deletedwithdiff.*fallback), and wire settings at TUI startupValidation
Related issues: openai#12749 openai#12904 openai#12912
Examples:
.tmThemefiles to ~/codex/themes/