Chat: find in chat (Ctrl+F / Cmd+F)
A find bar over the transcript: query, Match case, n of N (counted from the newest), Enter for an older match and Shift+Enter for a newer one. Matches are painted over the rendered text, code blocks included, without restyling it; the current match is scrolled into view. Matches in history not loaded yet come from the server's chat:<id>-scoped search and are reached by loading older pages. Esc closes and returns to the composer. The key is the pane's, so a focused terminal keeps Ctrl+F. Fixture answers scoped searches for captures; cheatsheet lists the key. The scoped search matches the query as typed, spaces included, like the client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'chat_find_highlight.dart';
|
||||
import 'chat_link_launcher.dart';
|
||||
import 'chat_link_spans.dart';
|
||||
import 'chat_links.dart';
|
||||
@@ -38,8 +39,19 @@ class _ChatLinkTextState extends State<ChatLinkText> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
final _textKey = GlobalKey();
|
||||
|
||||
/// The text with find's matches painted behind it; it renders verbatim,
|
||||
/// so a match's offsets are the rendered characters'.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget build(BuildContext context) => ChatFindHighlight(
|
||||
text: widget.text,
|
||||
rects: (start, end, box) =>
|
||||
chatFindPlainRects(_textKey.currentContext, start, end, box),
|
||||
child: KeyedSubtree(key: _textKey, child: _text(context)),
|
||||
);
|
||||
|
||||
Widget _text(BuildContext context) {
|
||||
final text = widget.text;
|
||||
if (_found.isEmpty) {
|
||||
return ChatTranscriptSelectionScope.maybeOf(context) == null
|
||||
|
||||
Reference in New Issue
Block a user