hermes-agent/ui-tui/src
ethernet d6c76cfbfa test(tui): extract cursor-layout + fast-echo helpers for real unit tests
textInputCursorSourceOfTruth.test.ts read textInput.tsx as text and
regexed it to check that cursorLayout() is called with curRef.current
(not the stale cur React state), and that the fast-echo backspace/append
stdout writes are paired with noteCursorAdvance calls.

Extract three pure functions from textInput.tsx:
- resolveCursorLayout(display, cur, curRefCurrent, columns): wraps
  cursorLayout(display, curRefCurrent, columns), making the
  curRef.current-over-cur choice a directly testable pure call instead of
  a regex match on the render-site call expression.
- fastBackspaceEffect(current, cursor) / fastAppendEffect(current, cursor,
  text): return a single object bundling {newValue, newCursor, write,
  advanceDelta} for each fast-echo path. Bundling the stdout write and the
  noteCursorAdvance delta into one return value makes the pairing
  impossible to silently drift apart (a caller can't get  without
  ), instead of relying on the two call sites appearing near
  each other in source text.

textInput.tsx's render site and backspace/append handlers now call these
helpers directly, preserving exact existing behavior (the same '\b \b'
write sequence, noteCursorAdvance(-1)/noteCursorAdvance(text.length) calls).

textInputCursorSourceOfTruth.test.ts imports and calls the three pure
functions directly with a deliberately stale cur vs a fresh curRefCurrent
to reconstruct the exact regression scenario, and asserts the bundled
effect objects -- no readFileSync, no regex against textInput.tsx's
source text. Full ui-tui suite (107 files, 1117 tests) still green.
2026-07-13 17:22:17 -04:00
..
__tests__ test(tui): extract cursor-layout + fast-echo helpers for real unit tests 2026-07-13 17:22:17 -04:00
app fix(approval): scope smart deny owner overrides to one operation 2026-07-13 04:31:55 -07:00
components test(tui): extract cursor-layout + fast-echo helpers for real unit tests 2026-07-13 17:22:17 -04:00
config fix(tui): coalesce drag-resize reflow + harden resize-burst heal coverage 2026-06-30 16:47:39 -07:00
content
…
domain fix(tui): preserve picker session scope across all paths 2026-07-11 08:39:17 -07:00
hooks
…
lib test(tui): extract resize coalescer into a unit-tested helper 2026-06-30 16:47:39 -07:00
protocol
…
types
…
app.tsx
…
banner.ts
…
entry.tsx
…
gatewayClient.ts fix(tui): defer buffered gateway events to stop dashboard chat #301 (#36658) 2026-06-28 14:18:47 +05:30
gatewayTypes.ts fix(approval): scope smart deny owner overrides to one operation 2026-07-13 04:31:55 -07:00
theme.ts
…
types.ts fix(approval): scope smart deny owner overrides to one operation 2026-07-13 04:31:55 -07:00