Jedi code format: refactor, extract function FormatIncludeFile

This commit is contained in:
DomingoGP 2025-03-09 10:23:01 +01:00
parent b623211e02
commit 482124d17e

View File

@ -72,6 +72,7 @@ type
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure FormatIncludeFile(srcEditor: TSourceEditorInterface);
procedure DoFormatSelection(Sender: TObject); procedure DoFormatSelection(Sender: TObject);
procedure DoFormatIncludeFile(Sender: TObject); procedure DoFormatIncludeFile(Sender: TObject);
procedure DoFormatCurrentIDEWindow(Sender: TObject); procedure DoFormatCurrentIDEWindow(Sender: TObject);
@ -378,19 +379,22 @@ begin
end; end;
procedure TJcfIdeMain.DoFormatIncludeFile(Sender: TObject); procedure TJcfIdeMain.DoFormatIncludeFile(Sender: TObject);
begin
if (SourceEditorManagerIntf = nil) or (SourceEditorManagerIntf.ActiveEditor = nil) then
begin
LogIdeMessage('', 'No current window', mtInputError, -1, -1);
Exit;
end;
FormatIncludeFile(SourceEditorManagerIntf.ActiveEditor);
end;
procedure TJcfIdeMain.FormatIncludeFile(srcEditor: TSourceEditorInterface);
var var
srcEditor: TSourceEditorInterface;
sourceCode: string; sourceCode: string;
BlockBegin, BlockEnd: TPoint; BlockBegin, BlockEnd: TPoint;
fcConverter: TConverter; fcConverter: TConverter;
outputstr: string; outputstr: string;
begin begin
if (SourceEditorManagerIntf = nil) or (SourceEditorManagerIntf.ActiveEditor = nil) then
begin
LogIdeMessage('', 'No current window', mtInputError, -1, -1);
exit;
end;
srcEditor := SourceEditorManagerIntf.ActiveEditor;
if srcEditor.ReadOnly then if srcEditor.ReadOnly then
Exit; Exit;
sourceCode := srcEditor.GetText(False); //get ALL editor text. sourceCode := srcEditor.GetText(False); //get ALL editor text.