MG: fixed completion box for templates and identifiers

git-svn-id: trunk@1453 -
This commit is contained in:
lazarus 2002-02-22 14:25:02 +00:00
parent 2295af44f4
commit 63e0c71c47
3 changed files with 105 additions and 94 deletions

View File

@ -239,6 +239,10 @@ begin
if not fParsed then if not fParsed then
ParseCompletionList; ParseCompletionList;
Len := Length(AToken); Len := Length(AToken);
{$IFDEF SYN_LAZARUS}
if (Len=0) and Assigned(fOnTokenNotFound) then
fOnTokenNotFound(Self,AToken,AEditor,i);
{$ENDIF}
if (Len > 0) and (AEditor <> nil) and not AEditor.ReadOnly if (Len > 0) and (AEditor <> nil) and not AEditor.ReadOnly
and (fCompletions.Count > 0) and (fCompletions.Count > 0)
then begin then begin

View File

@ -6085,7 +6085,7 @@ begin
if FCodeLastActivated then begin if FCodeLastActivated then begin
// send command to source editor // send command to source editor
if ActiveSourceEditor=nil then exit; if ActiveSourceEditor=nil then exit;
ActiveSourceEditor.DoEditorBasicAction(EditorCommand); ActiveSourceEditor.DoEditorExecuteCommand(EditorCommand);
end else begin end else begin
// send command to form editor // send command to form editor
if ActiveUnitInfo=nil then exit; if ActiveUnitInfo=nil then exit;
@ -6107,6 +6107,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.229 2002/02/22 14:25:00 lazarus
MG: fixed completion box for templates and identifiers
Revision 1.228 2002/02/22 14:05:55 lazarus Revision 1.228 2002/02/22 14:05:55 lazarus
MG: edit menu reconnected to source editor MG: edit menu reconnected to source editor

View File

@ -194,7 +194,7 @@ type
procedure GetDialogPosition(Width, Height:integer; var Left,Top:integer); procedure GetDialogPosition(Width, Height:integer; var Left,Top:integer);
// editor commands // editor commands
procedure DoEditorBasicAction(EditorCommand: integer); procedure DoEditorExecuteCommand(EditorCommand: integer);
//used to get the word at the mouse cursor //used to get the word at the mouse cursor
Function GetWordAtPosition(Position : TPoint) : String; Function GetWordAtPosition(Position : TPoint) : String;
@ -1494,7 +1494,7 @@ begin
FVisible:=Value; FVisible:=Value;
end; end;
procedure TSourceEditor.DoEditorBasicAction(EditorCommand: integer); procedure TSourceEditor.DoEditorExecuteCommand(EditorCommand: integer);
begin begin
EditorComponent.ExecuteCommand(EditorCommand,' ',nil); EditorComponent.ExecuteCommand(EditorCommand,' ',nil);
end; end;
@ -1752,6 +1752,7 @@ procedure TSourceNotebook.OnCodeTemplateTokenNotFound(Sender: TObject;
AToken: string; AnEditor: TCustomSynEdit; var Index:integer); AToken: string; AnEditor: TCustomSynEdit; var Index:integer);
var P:TPoint; var P:TPoint;
begin begin
writeln('RRRRRRRRRRR ',AToken,',',AnEditor.ReadOnly,',',CurrentCompletionType=ctNone);
if (AnEditor.ReadOnly=false) and (CurrentCompletionType=ctNone) then begin if (AnEditor.ReadOnly=false) and (CurrentCompletionType=ctNone) then begin
CurrentCompletionType:=ctTemplateCompletion; CurrentCompletionType:=ctTemplateCompletion;
with AnEditor do with AnEditor do
@ -1901,7 +1902,9 @@ Begin
while (X2>0) and (CurLine[X2] in ['A'..'Z','a'..'z','0'..'9','_']) do dec(X2); while (X2>0) and (CurLine[X2] in ['A'..'Z','a'..'z','0'..'9','_']) do dec(X2);
CompName:=copy(CurLine,X2+1,X1-X2-1); CompName:=copy(CurLine,X2+1,X1-X2-1);
CompInt := TComponentInterface(FormEditor1.FindComponentByName(CompName)); CompInt := TComponentInterface(FormEditor1.FindComponentByName(CompName));
if CompInt = nil then Exit; if CompInt = nil then begin
ccSelection:='';
end else begin
//get all methods //get all methods
NewStr := ''; NewStr := '';
for I := 0 to CompInt.GetPropCount-1 do for I := 0 to CompInt.GetPropCount-1 do
@ -1994,6 +1997,7 @@ Begin
NewStr := ''; NewStr := '';
end; // end for end; // end for
end; end;
end;
ctWordCompletion: ctWordCompletion:
begin begin