mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 19:56:03 +02:00
codetools: indentation: only for new lines
git-svn-id: trunk@20459 -
This commit is contained in:
parent
15e0d0fdb0
commit
d6a7f25283
@ -386,7 +386,8 @@ var
|
||||
BlockStartPos:=Stack.Stack[Stack.Top-1].StartPos
|
||||
else
|
||||
BlockStartPos:=Block^.StartPos;
|
||||
Block^.InnerIdent:=
|
||||
if not PositionsInSameLine(Src,BlockStartPos,Block^.InnerStartPos) then
|
||||
Block^.InnerIdent:=
|
||||
GetLineIndentWithTabs(Src,Block^.InnerStartPos,DefaultTabWidth)
|
||||
-GetLineIndentWithTabs(Src,BlockStartPos,DefaultTabWidth);
|
||||
end;
|
||||
@ -402,10 +403,12 @@ var
|
||||
if (Block^.InnerStartPos=AtomStart)
|
||||
and (Policies<>nil) then begin
|
||||
if Block^.InnerIdent<0 then UpdateBlockInnerIndent;
|
||||
Policies.AddIndent(Block^.Typ,Typ,Block^.InnerIdent);
|
||||
{$IFDEF ShowCodeBeautifierParser}
|
||||
DebugLn([GetIndentStr(Stack.Top*2),'nested indentation learned ',FABBlockTypeNames[Block^.Typ],' to ',FABBlockTypeNames[Typ],': ',GetAtomString(@Src[AtomStart],NestedComments),' at ',PosToStr(p),' Indent=',Block^.InnerIdent]);
|
||||
{$ENDIF}
|
||||
if Block^.InnerIdent>=0 then begin
|
||||
Policies.AddIndent(Block^.Typ,Typ,Block^.InnerIdent);
|
||||
{$IFDEF ShowCodeBeautifierParser}
|
||||
DebugLn([GetIndentStr(Stack.Top*2),'nested indentation learned ',FABBlockTypeNames[Block^.Typ],' to ',FABBlockTypeNames[Typ],': ',GetAtomString(@Src[AtomStart],NestedComments),' at ',PosToStr(p),' Indent=',Block^.InnerIdent]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Stack.BeginBlock(Typ,AtomStart);
|
||||
@ -772,10 +775,12 @@ begin
|
||||
|
||||
if FirstAtomOnNewLine then begin
|
||||
UpdateBlockInnerIndent;
|
||||
Policies.AddIndent(Block^.Typ,bbtNone,Block^.InnerIdent);
|
||||
{$IFDEF ShowCodeBeautifierParser}
|
||||
DebugLn([GetIndentStr(Stack.Top*2),'Indentation learned for statements: ',FABBlockTypeNames[Block^.Typ],' Indent=',Block^.InnerIdent]);
|
||||
{$ENDIF}
|
||||
if Block^.InnerIdent>=0 then begin
|
||||
Policies.AddIndent(Block^.Typ,bbtNone,Block^.InnerIdent);
|
||||
{$IFDEF ShowCodeBeautifierParser}
|
||||
DebugLn([GetIndentStr(Stack.Top*2),'Indentation learned for statements: ',FABBlockTypeNames[Block^.Typ],' Indent=',Block^.InnerIdent]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
until false;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user