From 0941092b07cb03b96f09b0022d9108b9b42456d6 Mon Sep 17 00:00:00 2001 From: dailz Date: Tue, 14 Apr 2026 16:52:17 +0800 Subject: [PATCH] feat(tui): enable JSON expansion during Loading state --- crates/tui/src/app.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/crates/tui/src/app.rs b/crates/tui/src/app.rs index b6ea931..eaf9b75 100644 --- a/crates/tui/src/app.rs +++ b/crates/tui/src/app.rs @@ -212,9 +212,6 @@ impl App { /// Compute visual height for a single line without storing it. fn compute_visual_height(&self, line: usize, width: usize) -> usize { - if self.is_loading() { - return 1; // sampling mode: 1 visual row per line - } let raw = self.get_line(line).unwrap_or_default(); let display_text = if self.json_format { format_json_line(&raw) @@ -508,15 +505,13 @@ impl App { self.last_g_press = None; } KeyCode::Tab => { - if !self.is_loading() { - self.json_format = !self.json_format; - self.viewport_cache.invalidate(); - let width = self.viewport_cache.width; - if let AppLoadingState::Ready { reader } = &mut self.loading_state { - reader.invalidate_visual_height_index(); - if width > 0 { - reader.start_visual_height_rebuild(width, self.json_format); - } + self.json_format = !self.json_format; + self.viewport_cache.invalidate(); + let width = self.viewport_cache.width; + if let AppLoadingState::Ready { reader } = &mut self.loading_state { + reader.invalidate_visual_height_index(); + if width > 0 { + reader.start_visual_height_rebuild(width, self.json_format); } } self.last_g_press = None;