synedit, ide: fix sourcecompletion on windows after deactivate (part of bug #0012222)

git-svn-id: trunk@18208 -
This commit is contained in:
paul 2009-01-08 12:34:19 +00:00
parent 3d1d0e8d31
commit d2cfcc3186
2 changed files with 9 additions and 6 deletions

View File

@ -65,6 +65,7 @@ type
{$ENDIF}
TCodeCompletionEvent = procedure(var Value: string;
{$IFDEF SYN_LAZARUS}
SourceValue: string;
KeyChar: TUTF8Char;
{$ENDIF}
Shift: TShiftState) of object;
@ -1344,9 +1345,10 @@ begin
{$ENDIF}
//debugln('TSynCompletion.Validate B Position=',dbgs(Position));
if Position>=0 then begin
if Assigned(FOnCodeCompletion) then begin
if Assigned(FOnCodeCompletion) then
begin
Value := ItemList[Position];
FOnCodeCompletion(Value,{$IFDEF SYN_LAZARUS}KeyChar{$ENDIF}, Shift);
FOnCodeCompletion(Value,{$IFDEF SYN_LAZARUS}SelText, KeyChar{$ENDIF}, Shift);
SelText := Value;
end else
SelText := ItemList[Position];

View File

@ -553,7 +553,7 @@ type
procedure ccExecute(Sender: TObject);
procedure ccCancel(Sender: TObject);
procedure ccComplete(var Value: ansistring; KeyChar: TUTF8Char;
procedure ccComplete(var Value: string; SourceValue: string; KeyChar: TUTF8Char;
Shift: TShiftState);
function OnSynCompletionPaintItem(const AKey: string; ACanvas: TCanvas;
X, Y: integer; ItemSelected: boolean; Index: integer): boolean;
@ -3594,7 +3594,7 @@ begin
end;
end;
procedure TSourceNotebook.ccComplete(var Value: ansistring; KeyChar: TUTF8Char;
procedure TSourceNotebook.ccComplete(var Value: string; SourceValue: string; KeyChar: TUTF8Char;
Shift: TShiftState);
// completion selected -> deactivate completion form
// Called when user has selected a completion item
@ -3635,8 +3635,9 @@ var
Editor: TSynEdit;
OldCompletionType: TCompletionType;
Begin
if CurCompletionControl=nil then begin
Value:='';
if CurCompletionControl=nil then
begin
Value := SourceValue;
exit;
end;
OldCompletionType:=CurrentCompletionType;