mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-05 07:58:16 +02:00
IDE: auto indent for many cases
git-svn-id: trunk@20616 -
This commit is contained in:
parent
282a2b206c
commit
f2f207f212
@ -499,7 +499,7 @@ begin
|
||||
p:=StartPos;
|
||||
repeat
|
||||
ReadRawNextPascalAtom(Src,p,AtomStart,NestedComments);
|
||||
DebugLn(['TFullyAutomaticBeautifier.ParseSource Atom=',copy(Src,AtomStart,p-AtomStart)]);
|
||||
//DebugLn(['TFullyAutomaticBeautifier.ParseSource Atom=',copy(Src,AtomStart,p-AtomStart)]);
|
||||
if p>=EndPos then begin
|
||||
if (AtomStart<=p) and (p>EndPos) then begin
|
||||
LastAtomStart:=p;
|
||||
@ -1026,7 +1026,7 @@ var
|
||||
i: Integer;
|
||||
OldLength: Integer;
|
||||
begin
|
||||
DebugLn(['TFABPolicies.AddIndent Typ=',FABBlockTypeNames[Typ],' SubType=',FABBlockTypeNames[SubType]]);
|
||||
//DebugLn(['TFABPolicies.AddIndent Typ=',FABBlockTypeNames[Typ],' SubType=',FABBlockTypeNames[SubType]]);
|
||||
OldLength:=length(Indentations);
|
||||
i:=OldLength-1;
|
||||
while (i>=0) and (Indentations[i].Indent<>Indent) do dec(i);
|
||||
|
@ -14000,10 +14000,13 @@ var
|
||||
p: integer;
|
||||
NestedComments: Boolean;
|
||||
NewIndent: TFABIndentationPolicy;
|
||||
EditorIndex: LongInt;
|
||||
begin
|
||||
{$IFNDEF EnableIndenter}
|
||||
exit;
|
||||
{$ENDIF}
|
||||
EditorIndex:=SrcEditor.PageIndex;
|
||||
SaveSourceEditorChangesToCodeCache(EditorIndex);
|
||||
CodeBuf:=SrcEditor.CodeBuffer;
|
||||
CodeBuf.LineColToPosition(LogCaret.Y,LogCaret.X,p);
|
||||
debugln(['TMainIDE.OnSrcNoteBookGetIndent AAA1 ',dbgs(LogCaret),' p=',p,' ',CodeBuf.Filename,' ',CodeBuf.SourceLength]);
|
||||
@ -14011,8 +14014,12 @@ begin
|
||||
NestedComments:=CodeToolBoss.GetNestedCommentsFlagForFile(CodeBuf.Filename);
|
||||
if not CodeToolBoss.Indenter.GetIndent(CodeBuf.Source,p,NestedComments,NewIndent)
|
||||
then exit;
|
||||
debugln(['TMainIDE.OnSrcNoteBookGetIndent AAA2 ',NewIndent.IndentValid,' ',NewIndent.Indent]);
|
||||
debugln(['TMainIDE.OnSrcNoteBookGetIndent AAA2 ',NewIndent.IndentValid,' ',NewIndent.Indent,' Indent=',Indent,' BasedLine=',BasedLine,' ReplaceIndent=',ReplaceIndent]);
|
||||
if not NewIndent.IndentValid then exit;
|
||||
Indent:=NewIndent.Indent+1;
|
||||
ReplaceIndent:=true;
|
||||
BasedLine:=-1;
|
||||
DebugLn(['TMainIDE.OnSrcNoteBookGetIndent END Indent=',Indent,' ReplaceIndent=',ReplaceIndent,' BasedLine=',BasedLine]);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnSrcNotebookMovingPage(Sender: TObject; OldPageIndex,
|
||||
|
Loading…
Reference in New Issue
Block a user