diff --git a/delphi-backend/Source/PM.Bridge.pas b/delphi-backend/Source/PM.Bridge.pas index 7841828..f7aff3f 100644 --- a/delphi-backend/Source/PM.Bridge.pas +++ b/delphi-backend/Source/PM.Bridge.pas @@ -1315,32 +1315,45 @@ begin // Past every bail-out — the keystrokes below are the fill itself. Result := True; - // Username-only: type just the username into the focused field, no Tab, - // no password. Used by the quick-search right-click / Shift+Enter path. - if AUsernameOnly then - begin + // Our own new-entry hotkey is Ctrl+Shift+A. The clear-field step injects a + // real Ctrl+A; if the user still physically holds Ctrl+Shift (they just + // pressed the autofill hotkey, and auto-repeat re-presses the modifiers + // faster than ForceReleaseModifiers can clear them), the system sees + // Ctrl+Shift+A and fires new-entry mid-fill. Unregister it for the duration + // of the SendInput so no WM_HOTKEY is generated; re-register in finally. + UnregisterHotKey(FMsgWindow, NEW_ENTRY_HOTKEY_ID); + try + // Username-only: type just the username into the focused field, no Tab, + // no password. Used by the quick-search right-click / Shift+Enter path. + if AUsernameOnly then + begin + ClearFieldIfWanted; + SendUnicodeString(AUsername); + Exit; + end; + + if AUsername = '' then + begin + ClearFieldIfWanted; + SendUnicodeString(APassword); + Exit; + end; + ClearFieldIfWanted; SendUnicodeString(AUsername); - Exit; - end; - - if AUsername = '' then - begin + Sleep(200); + // Real-VK send: a physically held Shift here turns Tab into Shift+Tab — + // focus moves BACKWARD and the password lands in the username field. + ForceReleaseModifiers; + SendVKey(VK_TAB); + Sleep(200); ClearFieldIfWanted; SendUnicodeString(APassword); - Exit; + finally + if FNewEntryHotkeyRegistered then + RegisterHotKey(FMsgWindow, NEW_ENTRY_HOTKEY_ID, + AF_MOD_CONTROL or AF_MOD_SHIFT, Ord('A')); end; - - ClearFieldIfWanted; - SendUnicodeString(AUsername); - Sleep(200); - // Real-VK send: a physically held Shift here turns Tab into Shift+Tab — - // focus moves BACKWARD and the password lands in the username field. - ForceReleaseModifiers; - SendVKey(VK_TAB); - Sleep(200); - ClearFieldIfWanted; - SendUnicodeString(APassword); end; end.