Show both keymap notice and logging warning at startup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
sanapachandClaude Opus 5.5 committed 2026-11-19 15:26:30 +02:00
1 parent 78bf2cf583
commit 595c886303
3 files changed
+49 -8

No files matched your search

+8 -2
View File
@@ -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".
+38 -5
View File
@@ -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<String>,
second: Option<String>,
) -> Option<String> {
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);
}
}
+3 -1
View File
@@ -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