feat(tui): add Tab key to toggle JSON pretty-print

Press Tab to switch JSON log lines between raw single-line and indented
multi-line format (2-space indent, like jq output). Only JSON Object lines
are affected; plain text lines stay unchanged.

- Add json_format bool field to App, toggled by Tab
- Add format_json_line() standalone function with serde_json::to_string_pretty
- Integrate into recompute_wrap_cache with \n-split sub-line wrapping
- Center viewport on cursor after cache rebuild to prevent jump on toggle
- Add 12 unit tests covering format, toggle, and edge cases

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
dailz
2026-04-11 11:38:30 +08:00
parent 8a664c02c8
commit 280c3f5014
3 changed files with 319 additions and 3 deletions

View File

@@ -9,4 +9,4 @@ crossterm.workspace = true
clap.workspace = true
anyhow.workspace = true
log-viewer-core.workspace = true
textwrap.workspace = true
serde_json.workspace = true