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.
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/