feat(tui): enable JSON expansion during Loading state

This commit is contained in:
dailz
2026-04-14 16:52:17 +08:00
parent 4ec3eb7cee
commit 0941092b07

View File

@@ -212,9 +212,6 @@ impl App {
/// Compute visual height for a single line without storing it. /// Compute visual height for a single line without storing it.
fn compute_visual_height(&self, line: usize, width: usize) -> usize { 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 raw = self.get_line(line).unwrap_or_default();
let display_text = if self.json_format { let display_text = if self.json_format {
format_json_line(&raw) format_json_line(&raw)
@@ -508,7 +505,6 @@ impl App {
self.last_g_press = None; self.last_g_press = None;
} }
KeyCode::Tab => { KeyCode::Tab => {
if !self.is_loading() {
self.json_format = !self.json_format; self.json_format = !self.json_format;
self.viewport_cache.invalidate(); self.viewport_cache.invalidate();
let width = self.viewport_cache.width; let width = self.viewport_cache.width;
@@ -518,7 +514,6 @@ impl App {
reader.start_visual_height_rebuild(width, self.json_format); reader.start_visual_height_rebuild(width, self.json_format);
} }
} }
}
self.last_g_press = None; self.last_g_press = None;
} }
KeyCode::Char('s') | KeyCode::Char('S') KeyCode::Char('s') | KeyCode::Char('S')