mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 23:39:24 +02:00
fixed syncompletion for UTF8 keypress
git-svn-id: trunk@7248 -
This commit is contained in:
parent
19553ee2d3
commit
107a955dd6
@ -62,6 +62,8 @@ type
|
||||
TValidateEvent = procedure(Sender: TObject; Shift: TShiftState) of object;
|
||||
TSynBaseCompletionSearchPosition = procedure(var Position :integer) of object;
|
||||
|
||||
{ TSynBaseCompletionForm }
|
||||
|
||||
TSynBaseCompletionForm = class(TForm)
|
||||
protected
|
||||
FCurrentString: string;
|
||||
@ -83,6 +85,7 @@ type
|
||||
FOnKeyCompletePrefix: TNotifyEvent;
|
||||
FTextColor: TColor;
|
||||
FTextSelectedColor: TColor;
|
||||
procedure UTF8KeyPress(var UTF8Key: TUTF8Char); override;
|
||||
{$ENDIF}
|
||||
procedure SetCurrentString(const Value: string);
|
||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||
@ -559,6 +562,25 @@ begin
|
||||
Position := Position - 1;
|
||||
end;
|
||||
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
procedure TSynBaseCompletionForm.UTF8KeyPress(var UTF8Key: TUTF8Char);
|
||||
begin
|
||||
if UTF8Key=#8 then begin
|
||||
if Assigned(OnUTF8KeyPress) then OnUTF8KeyPress(Self, UTF8Key);
|
||||
end else if (length(UTF8Key)>=1) and (not (UTF8Key[1] in [#33..'z'])) then
|
||||
begin
|
||||
if Assigned(OnCancel) then
|
||||
OnCancel(Self);
|
||||
end else begin
|
||||
if Assigned(OnUTF8KeyPress) then
|
||||
OnUTF8KeyPress(Self, UTF8Key);
|
||||
if UTF8Key<>'' then
|
||||
CurrentString := CurrentString + UTF8Key;
|
||||
end;
|
||||
UTF8Key:='';
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TSynBaseCompletionForm.SetCurrentString(const Value: string);
|
||||
var
|
||||
i: integer;
|
||||
|
Loading…
Reference in New Issue
Block a user