From 595c88630338fc45cdca04845cab0577279da1ef Mon Sep 17 00:00:00 2001 From: Sanapach Date: Thu, 19 Nov 2026 15:26:30 +0200 Subject: [PATCH] Show both keymap notice and logging warning at startup Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 10 ++++++++-- src/app/mod.rs | 43 ++++++++++++++++++++++++++++++++++++++----- src/main.rs | 4 +++- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8983577..a8beae7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,8 +21,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 number keys. - Keymap files without `version` keep their tab shortcuts: `GoToTab` indices are remapped in memory (3 → 4 Settings, 4 → 5 Logs, and 5 → 3 Podcasts - from the prototype podcast build) with a one-time startup notice. The file - is not rewritten; `version = 2` files are used as written. + from the prototype podcast build) with a non-blocking startup notice. The + file is not rewritten; `version = 2` files are used as written. A `version` + key placed inside a `[[keymaps]]` entry is reported as an error instead of + being ignored. +- The tab bar shortens titles, then shows only numbers (keeping the active + tab's full title) on terminals too narrow for all six tabs. +- A keymap notice no longer hides a "logging disabled" startup warning; both + are shown. - The help window names the target tab for number-key shortcuts ("Go to Settings") instead of "Go to tab N". diff --git a/src/app/mod.rs b/src/app/mod.rs index 9c4517a..8c90611 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -93,6 +93,17 @@ fn now_epoch_seconds() -> i64 { .unwrap_or(0) } +/// Joins two optional startup status messages with `; `, keeping both. +pub(crate) fn join_status_messages( + first: Option, + second: Option, +) -> Option { + match (first, second) { + (Some(left), Some(right)) => Some(format!("{left}; {right}")), + (left, right) => left.or(right), + } +} + fn err_string(err: anyhow::Error) -> String { format!("{err:#}") } @@ -394,11 +405,7 @@ pub async fn run( tracing::info!(path = %db_path.display(), "library opened"); let (settings, settings_warning) = crate::config::settings::load(); - let status_message = match (startup_warning, settings_warning) { - (Some(left), Some(right)) => Some(format!("{left}; {right}")), - (Some(message), None) | (None, Some(message)) => Some(message), - (None, None) => None, - }; + let status_message = join_status_messages(startup_warning, settings_warning); let mut state = AppState { status_message, ..AppState::default() @@ -4491,3 +4498,29 @@ fn push_media_metadata(state: &AppState, runtime: &Runtime) { }); } } + +#[cfg(test)] +mod status_message_tests { + use super::join_status_messages; + + #[test] + fn startup_messages_are_joined_not_dropped() { + assert_eq!( + join_status_messages( + Some("keymap notice".into()), + Some("logging disabled: x".into()) + ) + .as_deref(), + Some("keymap notice; logging disabled: x") + ); + assert_eq!( + join_status_messages(None, Some("only".into())).as_deref(), + Some("only") + ); + assert_eq!( + join_status_messages(Some("only".into()), None).as_deref(), + Some("only") + ); + assert_eq!(join_status_messages(None, None), None); + } +} diff --git a/src/main.rs b/src/main.rs index a540345..c906a76 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,7 +65,9 @@ fn main() -> Result<()> { // after local guards have been dropped and the terminal has been restored. let _stderr_capture = capture_stderr(); let (keymap, keymap_warning) = config::keymap::Keymap::load(); - let startup_warning = keymap_warning.or(startup_warning); + // The keymap message may be an informational notice; keep both so a + // logging failure is not hidden behind it. + let startup_warning = app::join_status_messages(keymap_warning, startup_warning); // The app (tokio + TUI) runs on a worker thread; the main thread stays // dedicated to the OS media-key event loop — on macOS the system only