Integrate Find with transcript selection mode (#57222)

## What changed

- Support `/` to open Find in selection mode and `Enter` to move the cursor to the match, extending an active selection.
- Repeat the accepted search from the cursor with `n` for older matches and `Shift+n` for newer matches. Cancel pending repeats when the cursor or selection changes.
- Restore the previous search, cursor, and selection when cancelling a new search, and reuse the previous search when accepting an empty query.
- Align the cursor to selectable graphemes and preserve expanded matches when leaving selection mode.

## Testing

Add regression coverage for search acceptance and cancellation, repeated searches, Unicode cursor placement, expanded output retention, and history pages loaded while a search is saved.

GitOrigin-RevId: 077be52a54d5e006f65eacc4634baf8c089d3662
This commit is contained in:
Felipe Coury
2026-10-26 20:08:18 +00:00
committed by copyberry
parent abf4bb91ec
commit 285fc74305
7 changed files with 605 additions and 27 deletions
+15
View File
@@ -202,6 +202,21 @@ impl TranscriptView {
return Some(action);
}
if self.select_mode.is_some() {
if self.is_search_editing() {
let (code, modifiers) =
crate::key_hint::normalize_key_parts(key.code, key.modifiers);
let accepting = code == KeyCode::Enter && modifiers == KeyModifiers::NONE;
let cancelling = code == KeyCode::Esc
|| (code == KeyCode::Char('c') && modifiers == KeyModifiers::CONTROL);
if self.handle_search_key(key, cells) {
if accepting && self.search.is_reading() {
self.accept_search_into_select_mode(cells);
} else if cancelling {
self.restore_select_search_origin();
}
return Some(ViewAction::Changed);
}
}
return self
.handle_select_mode_key(key, cells)
.or(Some(ViewAction::Changed));