mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 11:38:04 +02:00
Cocoa: IME: improve NSKeyUp and fix the issue in TComboBox
fix the issue that the first letter is added when using IME in TComboBox with AutoComplete (trigger AutoComplete in KeyUp)
This commit is contained in:
parent
14cf563d3e
commit
865a019ef0
@ -551,14 +551,24 @@ begin
|
||||
begin
|
||||
responder := win.firstResponder;
|
||||
cb := responder.lclGetCallback;
|
||||
if Assigned(cb) and (theEvent.type_=NSKeyDown) then
|
||||
if Assigned(cb) then
|
||||
begin
|
||||
// set CocoaOnlyState when NSKeyDown only,
|
||||
// keep last CocoaOnlyState when NSKeyUp
|
||||
if responder.conformsToProtocol(objcprotocol(NSTextInputClientProtocol)) then
|
||||
cb.CocoaOnlyState := NSTextInputClientProtocol(responder).hasMarkedText
|
||||
else
|
||||
cb.CocoaOnlyState := false;
|
||||
case theEvent.type_ of
|
||||
NSKeyDown:
|
||||
// when NSKeyDown, always reset CocoaOnlyState
|
||||
if responder.conformsToProtocol(objcprotocol(NSTextInputClientProtocol)) then
|
||||
cb.CocoaOnlyState := NSTextInputClientProtocol(responder).hasMarkedText
|
||||
else
|
||||
cb.CocoaOnlyState := false;
|
||||
NSKeyUp:
|
||||
// when NSKeyUp, reset CocoaOnlyState only if it's false (last KeyDown set)
|
||||
// keep true if CocoaOnlyState=true
|
||||
if not cb.CocoaOnlyState then
|
||||
begin
|
||||
if responder.conformsToProtocol(objcprotocol(NSTextInputClientProtocol)) then
|
||||
cb.CocoaOnlyState := NSTextInputClientProtocol(responder).hasMarkedText;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user