diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index 805774f149..18dd509f5a 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -5859,6 +5859,7 @@ begin end; end else begin // insert as first variable/proc + //debugln(['TCodeCompletionCodeTool.InsertNewClassParts ',ClassSectionNode.DescAsString,' ',dbgstr(copy(Src,ClassSectionNode.StartPos,ClassSectionNode.EndPos-ClassSectionNode.StartPos))]); Indent:=GetLineIndent(Src,ClassSectionNode.StartPos) +ASourceChangeCache.BeautifyCodeOptions.Indent; InsertPos:=ClassSectionNode.StartPos; @@ -5867,7 +5868,10 @@ begin then begin // the first published section has no keyword if ClassSectionNode.NextBrother<>nil then - Indent:=GetLineIndent(Src,ClassSectionNode.StartPos) + Indent:=GetLineIndent(Src,ClassSectionNode.NextBrother.StartPos) + +ASourceChangeCache.BeautifyCodeOptions.Indent + else + Indent:=GetLineIndent(Src,ClassSectionNode.Parent.StartPos) +ASourceChangeCache.BeautifyCodeOptions.Indent; end else if (ClassSectionNode.Desc in (AllClassBaseSections+[ctnClassType])) then begin diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index 5bb9e1ab23..886cd84191 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -3727,7 +3727,6 @@ begin // start the first class section (always published) CreateChildNode; CurNode.Desc:=ctnClassPublished; - CurNode.StartPos:=CurPos.EndPos; // behind 'class' including the space if CurPos.Flag=cafEdgedBracketOpen then ReadGUID; // parse till "end" of class/object