fix(quick-search): only tray-hidden windows go back to the tray on close

wasHidden counted IsIconic too, so a window merely minimised to the taskbar
("visible" to the user) was treated as tray-origin: Esc/pick sent it to the
TRAY, vanishing from the taskbar it came from. wasHidden is now strictly
"came from the tray" (Visible=false); an iconic window gets restored by the
hotkey and simply stays open when the modal closes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-12 20:12:41 +01:00
parent 3b756648c5
commit 770504ea03
+10 -7
View File
@@ -341,8 +341,11 @@ begin
// the password into it. Then pop the modal in fill mode.
if not FServer.Active then Exit;
FAutofillTargetHWND := ATargetHWND;
LWasHidden := (not Self.Visible) or
IsIconic(WindowHandleToPlatform(Self.Handle).Wnd);
// Tray-hidden ONLY (Visible=false). A window merely minimised to the
// taskbar must NOT count: hide-after would send it to the TRAY on close —
// it vanishes from the taskbar it came from. Restored-from-iconic just
// stays open after the modal closes.
LWasHidden := not Self.Visible;
FBridge.RestoreFromTray;
LWasHiddenJs := BoolToStr(LWasHidden, True).ToLower;
// Second arg forFill=true tells JS to SendInput on pick instead of copy.
@@ -362,11 +365,11 @@ begin
// see the modal, then ask JS to open it. JS handles the locked-vault
// case (shows the auth screen with master-pw focused instead).
if not FServer.Active then Exit;
// Remember whether the window was hidden BEFORE we restore — after the
// user picks an entry the JS layer asks us to minimize back so they can
// paste into the target app without an extra alt-tab.
LWasHidden := (not Self.Visible) or
IsIconic(WindowHandleToPlatform(Self.Handle).Wnd);
// Remember whether the window was TRAY-hidden BEFORE we restore — after
// the user picks an entry the JS layer asks us to minimize back so they
// can paste into the target app without an extra alt-tab. Iconic-only
// (taskbar) does NOT count — see BridgeQuickSearchHotkey.
LWasHidden := not Self.Visible;
FBridge.RestoreFromTray;
LWasHiddenJs := BoolToStr(LWasHidden, True).ToLower;
WebBrowser.ExecuteJavaScript(