mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 18:17:18 +02:00
codetools: fixed adding uses section to program
git-svn-id: trunk@56232 -
This commit is contained in:
parent
a1f502d251
commit
e20bbbe399
@ -961,7 +961,7 @@ function TStandardCodeTool.AddUnitToSpecificUsesSection(UsesSection: TUsesSectio
|
||||
const NewUnitName, NewUnitInFile: string; SourceChangeCache: TSourceChangeCache;
|
||||
AsLast: boolean; CheckSpecialUnits: boolean): boolean;
|
||||
var
|
||||
UsesNode, OtherUsesNode, SectionNode: TCodeTreeNode;
|
||||
UsesNode, OtherUsesNode, SectionNode, Node: TCodeTreeNode;
|
||||
NewUsesTerm: string;
|
||||
InsertPos: integer;
|
||||
Junk: TAtomPosition;
|
||||
@ -1047,8 +1047,11 @@ begin
|
||||
if InsertPos<1 then begin
|
||||
// not a unit (i.e. program)
|
||||
// => insert after title and directives
|
||||
if SectionNode.Next<>nil then begin
|
||||
InsertPos:=FindLineEndOrCodeInFrontOfPosition(SectionNode.Next.StartPos,
|
||||
Node:=SectionNode.Next;
|
||||
if (Node<>nil) and (Node.Desc=ctnSrcName) then
|
||||
Node:=Node.NextSkipChilds;
|
||||
if Node<>nil then begin
|
||||
InsertPos:=FindLineEndOrCodeInFrontOfPosition(Node.StartPos,
|
||||
true);
|
||||
end else begin
|
||||
// program empty => add at end
|
||||
|
Loading…
Reference in New Issue
Block a user