better json printing

This commit is contained in:
Jana Dönszelmann 2026-02-25 01:15:01 +01:00
parent 3037d0711e
commit d989f6e31e
No known key found for this signature in database
2 changed files with 22 additions and 5 deletions

View file

@ -13,6 +13,7 @@ use tui_widget_list::{ListBuilder, ListView};
use crate::tui::{
filter::{FilterKind, WipMatcher},
log_viewer::{InputState, InputTarget, LogViewer},
model::pretty_print_value,
};
use crate::tui::{
filter::{FilterSelection, WipFilter},
@ -473,9 +474,7 @@ impl Widget for &mut App {
let Some((k, v)) = &items.get(cx.index) else {
return (Paragraph::new(""), 1);
};
let contents = serde_json::to_string_pretty(&v)
.unwrap_or(String::new())
.replace("\n", "\n{:width$}");
let contents = pretty_print_value(&v);
let mut res = Paragraph::new(format!("{k:width$} {contents}"))
.wrap(Wrap { trim: false });