From 6a244fb21c6dcb285246201935294b7add7af63b 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 d992b59a..d91a5b51 100644 --- a/crates/oa-desktop/src/app/source_symbols.rs +++ b/crates/oa-desktop/src/app/source_symbols.rs @@ -145,6 +145,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; } } @@ -174,13 +178,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 {