fix(config): allow missing tui status items

Treat a missing tui.status_items field as None even when the [tui]
  table exists, preserving the documented default footer behavior.

  Add a regression test for configs that define [tui] without status_items.
This commit is contained in:
reidliu41
2026-06-01 16:41:50 +08:00
committed by Hunter B
parent 0af80e262f
commit c1f74b3b2f
+11 -1
View File
@@ -666,7 +666,7 @@ pub struct TuiConfig {
///
/// Edited interactively via `/statusline`; persisted to `tui.status_items`
/// in `~/.deepseek/config.toml`.
#[serde(deserialize_with = "deser_status_items")]
#[serde(default, deserialize_with = "deser_status_items")]
pub status_items: Option<Vec<StatusItem>>,
/// Emit OSC 8 hyperlink escape sequences around URLs in the transcript so
/// supporting terminals (iTerm2, Terminal.app 13+, Ghostty, Kitty,
@@ -8814,4 +8814,14 @@ model = "deepseek-ai/deepseek-v4-pro"
assert_eq!(items[2], StatusItem::Cost);
assert_eq!(items[3], StatusItem::Status);
}
#[test]
fn status_items_deser_allows_missing_field() {
let toml_str = r#"
locale = "zh-Hans"
mouse_capture = false
"#;
let tui: TuiConfig = toml::from_str(toml_str).expect("missing status_items should parse");
assert_eq!(tui.status_items, None);
}
}