mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 18:39:47 +02:00
Jedi code format: refactor, extract function FormatIncludeFile
This commit is contained in:
parent
b623211e02
commit
482124d17e
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user