mirror of
https://git.srhtnin.garden/sarah/SaraFem.git
synced 2026-10-13 18:18:11 +02:00
Fix real root cause: Ctrl+F leaves CtrlHeld stuck, breaking double-click into directories
This commit is contained in:
1 parent
a39533a522
commit
8eaebbb3e4
1 file changed
+25
-2
+25
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user