feat(ui): add file icon resolver with Nerd/ASCII sets, env override, and breadcrumb display

- Introduce `IconMode` in core config (default Auto) and bump schema version to 1.4.0.
- Add `FileIconSet`, `IconDetection`, and `FileIconResolver` to resolve per‑file icons with configurable fallbacks and environment variable `OWLEN_TUI_ICONS`.
- Export resolver types from `owlen-tui::state::file_icons`.
- Extend `ChatApp` with `file_icons` field, initialize it from config, and expose via `file_icons()` accessor.
- Append system status line showing selected icon set and detection source.
- Implement breadcrumb construction (`repo > path > file`) and display in code pane headers.
- Render icons in file tree, handle unsaved file markers, hidden files, and Git decorations with proper styling.
- Add helper `collect_unsaved_relative_paths` and tree line computation for visual guides.
- Provide `Workspace::panes()` iterator for unsaved tracking.
- Update UI imports and tests to cover new breadcrumb feature.
This commit is contained in:
2025-10-13 00:25:30 +02:00
parent 15f81d9728
commit 0da8a3f193
7 changed files with 604 additions and 40 deletions

View File

@@ -14,7 +14,7 @@ use std::time::Duration;
pub const DEFAULT_CONFIG_PATH: &str = "~/.config/owlen/config.toml";
/// Current schema version written to `config.toml`.
pub const CONFIG_SCHEMA_VERSION: &str = "1.3.0";
pub const CONFIG_SCHEMA_VERSION: &str = "1.4.0";
/// Core configuration shared by all OWLEN clients
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -724,6 +724,21 @@ pub struct UiSettings {
pub syntax_highlighting: bool,
#[serde(default = "UiSettings::default_show_timestamps")]
pub show_timestamps: bool,
#[serde(default = "UiSettings::default_icon_mode")]
pub icon_mode: IconMode,
}
/// Preference for which symbol set to render in the terminal UI.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(rename_all = "lowercase")]
pub enum IconMode {
/// Automatically detect support for Nerd Font glyphs.
#[default]
Auto,
/// Use only ASCII-safe symbols.
Ascii,
/// Force Nerd Font glyphs regardless of detection heuristics.
Nerd,
}
impl UiSettings {
@@ -771,6 +786,10 @@ impl UiSettings {
true
}
const fn default_icon_mode() -> IconMode {
IconMode::Auto
}
fn deserialize_role_label_mode<'de, D>(
deserializer: D,
) -> std::result::Result<RoleLabelDisplay, D::Error>
@@ -838,6 +857,7 @@ impl Default for UiSettings {
show_cursor_outside_insert: Self::default_show_cursor_outside_insert(),
syntax_highlighting: Self::default_syntax_highlighting(),
show_timestamps: Self::default_show_timestamps(),
icon_mode: Self::default_icon_mode(),
}
}
}