From 035bae98d9b5d2527286b24dbdcfe65670299751 Mon Sep 17 00:00:00 2001 From: objz Date: Sat, 25 Apr 2026 15:34:20 +0200 Subject: [PATCH] fix(logs): show real filename for live log and keep content on instance stop the live log entry now shows the actual log filename in green instead of a generic "Live" label. when the instance stops while viewing the live log, the viewer transitions to the on-disk file so the content stays visible instead of going blank. --- src/tui/widgets/logs_viewer.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/tui/widgets/logs_viewer.rs b/src/tui/widgets/logs_viewer.rs index c40252a..618defe 100644 --- a/src/tui/widgets/logs_viewer.rs +++ b/src/tui/widgets/logs_viewer.rs @@ -38,6 +38,7 @@ pub struct LogsState { pending: PendingLogs, rescan_counter: u8, instances_dir_cache: Option, + was_live: bool, } impl Default for LogsState { @@ -59,6 +60,7 @@ impl Default for LogsState { pending: Arc::new(Mutex::new(None)), rescan_counter: 0, instances_dir_cache: None, + was_live: false, } } } @@ -94,6 +96,14 @@ impl LogsState { } pub fn drain_pending(&mut self) { + // when the instance stops while viewing the live log, transition + // to the on-disk log file so the viewer doesn't go blank + let live_now = self.has_live(); + if self.was_live && !live_now && self.list_state.selected == Some(0) { + self.load_selected_content(); + } + self.was_live = live_now; + let taken = match self.pending.lock() { Ok(mut slot) => slot.take(), _ => None, @@ -419,7 +429,12 @@ fn render_list( let entries_snapshot: Vec<(String, bool)> = { let mut v = Vec::new(); if has_live { - v.push(("\u{25cf} Live".to_string(), true)); + let live_name = state + .entries + .first() + .map(|e| e.name.trim_end_matches(".log")) + .unwrap_or("Live"); + v.push((live_name.to_string(), true)); } for e in &state.entries { v.push((e.name.trim_end_matches(".log").to_string(), false));