From 5e62d88c4f6c67cce569c351774d4c03dc798754 Mon Sep 17 00:00:00 2001 From: "sorokin.oleg.edu" Date: Sat, 12 Sep 2026 21:54:16 -0700 Subject: [PATCH] Preserve live Text selection when restoring Find focus Keep existing reveal tickets and raw-input guards while separating focus restoration from cursor movement. This separable production patch is extracted from the Text workspace union verified by mounted red/green, full Windows gates and native replacement trials. The CBC-only intermediate tree was not separately built; the following contribution records exact tested union inputs and four-test integration guidance. --- crates/oa-desktop/src/app/source_symbols.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/crates/oa-desktop/src/app/source_symbols.rs b/crates/oa-desktop/src/app/source_symbols.rs index 66a239ef..c6fef7cc 100644 --- a/crates/oa-desktop/src/app/source_symbols.rs +++ b/crates/oa-desktop/src/app/source_symbols.rs @@ -165,6 +165,10 @@ impl App { && nav::exact_cursor(self.source_workspace.text(), cursor) { self.queue_source_reveal(cursor, false); + // This ticket restores focus to the live editor, not a saved cursor. + // Iced's Cursor omits Word/Line selection kind; moving back to that + // lossy value would collapse an actual word/line selection. + self.source_jump = None; } } @@ -194,13 +198,14 @@ impl App { if self.source_select_line && cursor.selection.is_none() { self.source_editor.perform(text_editor::Action::SelectLine); } - return nav::interaction::guarded_focus( - self.source_editor_id(), - self.source_symbols.raw_interaction.clone(), - raw_interaction, - ); } - Task::none() + // A valid ticket with no jump is focus-only. All intentional navigation + // still takes the cursor branch above, including explicit line selection. + nav::interaction::guarded_focus( + self.source_editor_id(), + self.source_symbols.raw_interaction.clone(), + raw_interaction, + ) } pub(super) fn source_symbol_event(&mut self, event: nav::SymbolEvent) -> Task {