mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
feat(tui): add /theme picker with live syntax-highlighted preview
Add a `/theme` slash command that opens an interactive picker listing all bundled and custom (.tmTheme) syntax themes. The picker shows a live-preview code snippet below the list that re-highlights as the user navigates, and restores the original theme on cancel. Key changes: - ListSelectionView gains `footer_content`, `on_selection_changed`, and `on_cancel` to support rich preview and lifecycle callbacks - highlight.rs: swap global Theme from OnceLock to RwLock for live swapping; add resolve/list/set/current helpers for theme management - New theme_picker module with ThemePreviewRenderable and picker builder - diff_render: make DiffLineType and helpers pub(crate); fix rename highlighting to use destination extension - markdown_render: fix CRLF double-newlines and info-string metadata parsing for fenced code blocks
This commit is contained in:
@@ -55,6 +55,14 @@ pub enum ConfigEdit {
|
||||
ClearPath { segments: Vec<String> },
|
||||
}
|
||||
|
||||
/// Produces a config edit that sets `[tui] theme = "<name>"`.
|
||||
pub fn syntax_theme_edit(name: &str) -> ConfigEdit {
|
||||
ConfigEdit::SetPath {
|
||||
segments: vec!["tui".to_string(), "theme".to_string()],
|
||||
value: value(name.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn status_line_items_edit(items: &[String]) -> ConfigEdit {
|
||||
let mut array = toml_edit::Array::new();
|
||||
for item in items {
|
||||
|
||||
Reference in New Issue
Block a user