zot/internal/tui
patriceckhart 64704875d2 tui: /jump to scroll to past turns, render cache for long transcripts
/jump:
- new slash command; opens a picker listing every user turn in
  the current session (timestamp relative, tool count badge, first
  line of the prompt). \u2191/\u2193 + enter scrolls the viewport to put
  that turn's user-message header at the top row. non-destructive,
  transcript untouched
- runes extend a live filter; backspace shortens. '/jump <text>'
  pre-applies the filter; exactly-one-match auto-jumps without
  showing the picker
- while parked on a past turn the scroll-up note reads 'viewing
  turn N of M \u00b7 pgdn to catch up' instead of the generic row
  count. scrolling back to the tail (or starting a new turn, or
  /clear) resets the parked state automatically
- view.go: new MessageAnchor type + BuildWithAnchors so the dialog
  can resolve msgIdx -> first rendered row

perf for long transcripts (the whole ui stutters on ~50 messages):
- view.renderCache: per-message memoisation keyed by (fnv1a of
  role+content, width, expandAll). finalised messages never change
  so the cache hit rate is ~100% after the first render. streaming
  partials and in-flight tool-call views stay uncached by design
- BuildWithAnchors now pre-sums line counts and allocates
  in a single make() instead of 50 appends with log2(N) backing-
  array memcpys
- truncateToWidth fast path: byte-length <= cols implies cell-width
  <= cols, so we skip the rune-width loop entirely. covers the huge
  majority of lines in a session
- cache purged on /clear, /compact completion, and session swap
  (applySessionSelection); resize invalidates implicitly via the
  width key. LRU eviction at 4x message count caps memory

impact: a 50-msg / 2000-line transcript went from unresponsive-
while-typing to drawing in well under a frame. measured locally
with go-perf traces; no change to correctness.
2026-04-18 12:22:16 +02:00
..
editor.go initial commit 2026-04-17 20:36:38 +02:00
highlight.go fix ci: portable syscall.Select via x/sys/unix; gofmt pass 2026-04-18 10:55:42 +02:00
image.go fix ci: portable syscall.Select via x/sys/unix; gofmt pass 2026-04-18 10:55:42 +02:00
input.go add collapsible code blocks 2026-04-18 10:30:29 +02:00
markdown.go fix code highlighting 2026-04-18 10:16:06 +02:00
render.go tui: /jump to scroll to past turns, render cache for long transcripts 2026-04-18 12:22:16 +02:00
resize_unix.go fix ci: portable syscall.Select via x/sys/unix; gofmt pass 2026-04-18 10:55:42 +02:00
resize_windows.go initial commit 2026-04-17 20:36:38 +02:00
terminal.go initial commit 2026-04-17 20:36:38 +02:00
theme.go fix ci: portable syscall.Select via x/sys/unix; gofmt pass 2026-04-18 10:55:42 +02:00
view.go tui: /jump to scroll to past turns, render cache for long transcripts 2026-04-18 12:22:16 +02:00