From f9a84e9f2fa598c0f905b5ecc4a32c66a61b0e06 Mon Sep 17 00:00:00 2001 From: juha Date: Fri, 5 Aug 2011 16:36:29 +0000 Subject: [PATCH] Codetools: Add a new uses-section right after interface/implementation keyword. Issue #19901, patch from Anton. git-svn-id: trunk@31878 - --- components/codetools/stdcodetools.pas | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/components/codetools/stdcodetools.pas b/components/codetools/stdcodetools.pas index cc018a27a7..cf1e14d4a4 100644 --- a/components/codetools/stdcodetools.pas +++ b/components/codetools/stdcodetools.pas @@ -957,15 +957,10 @@ begin usImplementation: SectionNode:=FindImplementationNode; end; if SectionNode<>nil then begin - // add uses to existing interface/implementation behind title and directives - if SectionNode.FirstChild<>nil then begin - // section not empty => add in front of first node - InsertPos:=FindLineEndOrCodeInFrontOfPosition(SectionNode.FirstChild.StartPos, - true); - end else begin - // section empty => add at end of interface section - InsertPos:=FindLineEndOrCodeInFrontOfPosition(SectionNode.EndPos,true); - end; + // add uses to existing interface/implementation before any content + MoveCursorToNodeStart(SectionNode); + ReadNextAtom; + InsertPos := CurPos.EndPos; end else begin // section is missing => add it SectionNode:=Tree.Root;