mirror of
https://github.com/openai/codex.git
synced 2026-11-07 20:30:33 +00:00
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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user