WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@joshka-oai
Copy link
Collaborator

Add an in-viewport find experience for the TUI2 transcript (the scrollable region above the composer), without introducing a persistent search bar or scroll indicator.

UX:

  • Ctrl-F opens a 1-row "/ " prompt above the composer and updates highlights live as you type
  • Ctrl-G jumps to the next match without closing the prompt, and keeps working after the prompt closes while the query is still active
  • Esc closes the prompt but keeps the active query/highlights; Esc again clears the search
  • Enter closes the prompt and jumps to the selected match

Implementation:

  • Add a dedicated transcript_find module to own query/edit state, smart-case matching over flattened transcript lines, stable jump anchoring (cell + line-in-cell), and per-line highlight rendering
  • Keep app.rs integration additive via small delegation calls from the key handler and render loop
  • Plumb find visibility to the footer so shortcuts show Ctrl-G next match only while the find prompt is visible

Docs/tests:

  • Add tui2/docs/transcript_find.md documenting current behavior vs the ideal/perfect end state and explicitly calling out deferred work
  • Stabilize VT100-based rendering tests by forcing color output and emitting crossterm fg/bg colors directly in insert-history output

Improve clipboard output for transcript selections, even when content is wrapped.

- Preserve meaningful indentation for code blocks.
- Treat soft-wrapped prose as a single logical line via wrap joiners.
- Emit Markdown source markers when copying (inline backticks, code fences).
- Extract selection/copy reconstruction into `transcript_copy`.
- Thread joiner metadata through history rendering and wrapping helpers.
- Update docs and add focused test coverage.
Support double/triple/quad click selection (word/line/paragraph) using
transcript/viewport coordinates rather than terminal buffer positions.

Multi-click expansion rebuilds the wrapped transcript view from
HistoryCell::display_lines(width) so boundaries match on-screen wrapping
during scroll/resize/streaming reflow. Drag selection resets the click
tracker to avoid accidental multi-click accumulation.

Tests cover click expansion, resets (time, movement, line change, drag),
and paragraph detection across spacer lines between history cells.
@joshka-oai
Copy link
Collaborator Author

image

Multi-click selection was flaky because we reset the click tracker on any mouse
drag event. Some terminals emit Drag events for very small cursor motion while
the button is held down (trackpad jitter), which breaks double/quad click
sequences.

Treat small drags as jitter: only reset the click tracker once the cursor moves
to another wrapped line or far enough horizontally from the anchor. Also loosen
click grouping as the sequence progresses and slightly increase the inter-click
timeout so quad-clicks are practical.

Add tests covering drag jitter and relaxed quad-click grouping.
Add a 5+ click gesture to select the entire history cell in the transcript.

Implementation notes:
- Selection is computed in transcript/viewport coordinates (wrapped visual line
  indices + content columns), not terminal buffer coordinates.
- We rebuild the wrapped transcript view and carry forward a mapping from each
  wrapped line to its originating HistoryCell index.
- Quint-click expands to the contiguous wrapped-line range for that cell; if the
  click lands on a spacer line between cells, it selects the cell above (falling
  back to the next cell below).

Tests cover selecting the full cell (including blank lines inside the cell) and
quint-click behavior on spacer lines.
The SGR writer tests intentionally construct truecolor (RGB) and indexed colors
so the emitted escape sequences are deterministic.

Replace the blanket allow on the whole test with statement-level
`#[expect(clippy::disallowed_methods)]` on the specific constructors
(`Color::Rgb`/`Color::Indexed`), with inline rationale.
Add an in-viewport find experience for the TUI2 transcript (the
scrollable region above the composer), without introducing a persistent
search bar or scroll indicator.

UX:
- Ctrl-F opens a 1-row "/ " prompt above the composer and updates
  highlights live as you type
- Ctrl-G jumps to the next match without closing the prompt, and keeps
  working after the prompt closes while the query is still active
- Esc closes the prompt but keeps the active query/highlights; Esc again
  clears the search
- Enter closes the prompt and jumps to the selected match

Implementation:
- Add a dedicated transcript_find module to own query/edit state,
  smart-case matching over flattened transcript lines, stable jump
  anchoring (cell + line-in-cell), and per-line highlight rendering
- Keep app.rs integration additive via small delegation calls from the
  key handler and render loop
- Plumb find visibility to the footer so shortcuts show Ctrl-G next match
  only while the find prompt is visible

Docs/tests:
- Add tui2/docs/transcript_find.md documenting current behavior vs the
  ideal/perfect end state and explicitly calling out deferred work
- Stabilize VT100-based rendering tests by forcing color output and
  emitting crossterm fg/bg colors directly in insert-history output
@joshka-oai joshka-oai force-pushed the joshka/tui2-transcript-find branch from 700a059 to 97c5463 Compare December 23, 2025 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants