From 8eaebbb3e47c9fe59dd79b2326afd15c440e30d5 Mon Sep 17 00:00:00 2001 From: SRHTNIN Date: Thu, 8 Oct 2026 17:57:06 +0200 Subject: [PATCH] Fix real root cause: Ctrl+F leaves CtrlHeld stuck, breaking double-click into directories --- Browser.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Browser.py b/Browser.py index a79110a..af6dadc 100644 --- a/Browser.py +++ b/Browser.py @@ -1044,9 +1044,18 @@ class Browser(ft.Row): def _ToggleSearchBar(self) -> None: """Ctrl+F. With SearchAlwaysVisible on, the bar's already there — this just (re)focuses it. Otherwise it opens/closes the bar itself; - closing also clears the filter, same as dismissing a find bar.""" + closing also clears the filter, same as dismissing a find bar. + + Resets ShiftHeld/CtrlHeld synchronously up front rather than only + relying on SearchField's on_focus (_SetShortcutsPaused) to do it — + that only fires once Flutter's async focus round-trip actually + completes, and Ctrl+F reaching here at all means Ctrl was just held + down for this same keypress (see _SetShortcutsPaused for the full + why).""" if not self.Config.ShowSearch: return + self.ShiftHeld = False + self.CtrlHeld = False if self.Config.SearchAlwaysVisible: self.page.run_task(self.SearchField.focus) return @@ -1650,8 +1659,22 @@ class Browser(ft.Row): """Same mechanism Picker.py already uses for its own inline text field (see EditorView's OnFocusChange): page.on_keyboard_event is global, not focus-scoped, so without this, typing in the in-app - editor also triggered Backspace-navigates-up / Enter-reopens-file.""" + editor also triggered Backspace-navigates-up / Enter-reopens-file. + + Pausing (a field just gained focus) also resets ShiftHeld/CtrlHeld, + the same fix _ShowDialog already needed and for the identical + reason: those two are only ever cleared by _OnListKeyUp, which only + fires while the file list's own KeyboardListener has focus. Ctrl+F + (opening/focusing the search bar) sets CtrlHeld via _OnListKeyDown + and then immediately moves focus to the search field — the matching + key-up never arrives, CtrlHeld stays stuck True, and every later + plain click gets treated as a Ctrl-click instead of a normal select + (reported as "can't double-click into a directory" once the search + bar's been opened, even with it left empty).""" self.ShortcutsPaused = Paused + if Paused: + self.ShiftHeld = False + self.CtrlHeld = False def _OnListKeyDown(self, Event) -> None: """Tracks live Shift/Ctrl-held state for click modifiers (see the