mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 21:19:07 +02:00
IDE: Editor-Options, fix mem leak
(cherry picked from commit e0d50a545c
)
This commit is contained in:
parent
cb412dc2d4
commit
f8bfee4292
@ -61,40 +61,43 @@ begin
|
|||||||
|
|
||||||
dir := AppendPathDelim(UserSchemeDirectory(False)) + 'tml';
|
dir := AppendPathDelim(UserSchemeDirectory(False)) + 'tml';
|
||||||
FileList := nil;
|
FileList := nil;
|
||||||
if DirectoryExistsUTF8(dir) then
|
try
|
||||||
FileList := FindAllFiles(dir, '*.json', False);
|
if DirectoryExistsUTF8(dir) then
|
||||||
|
FileList := FindAllFiles(dir, '*.json', False);
|
||||||
|
|
||||||
if (FileList = nil) or (FileList.Count = 0) then begin
|
if (FileList = nil) or (FileList.Count = 0) then begin
|
||||||
Memo1.Text := dlgColorsTmlNoFilesFound;
|
Memo1.Text := dlgColorsTmlNoFilesFound;
|
||||||
exit;
|
exit;
|
||||||
end;
|
|
||||||
|
|
||||||
for i := 0 to FileList.Count - 1 do begin
|
|
||||||
tmlHighlighter := TSynTextMateSyn.Create(nil);
|
|
||||||
tmlHighlighter.LoadGrammar(FileList[i], '');
|
|
||||||
|
|
||||||
Memo1.Lines.Add(tmlHighlighter.LanguageName);
|
|
||||||
Memo1.Lines.Add('- '+dlgColorsTmlFromFile+' '+FileList[i]);
|
|
||||||
|
|
||||||
if (tmlHighlighter.ParserError <> '') then begin
|
|
||||||
Memo1.Lines.Add('- '+dlgColorsTmlError+' '+tmlHighlighter.ParserError);
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
if (tmlHighlighter.TextMateGrammar.SampleText = '') then begin
|
|
||||||
if (tmlHighlighter.TextMateGrammar.SampleTextFile = '') then
|
|
||||||
Memo1.Lines.Add('- '+dlgColorsTmlNoSampleTxt)
|
|
||||||
else
|
|
||||||
if not FileExistsUTF8(TrimAndExpandFilename(tmlHighlighter.TextMateGrammar.SampleTextFile, dir)) then
|
|
||||||
Memo1.Lines.Add('- '+Format(dlgColorsTmlBadSampleTxtFile, [LineEnding+'', tmlHighlighter.TextMateGrammar.SampleTextFile]));
|
|
||||||
end;
|
|
||||||
|
|
||||||
Memo1.Lines.Add('- '+dlgColorsTmlOk);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Memo1.Lines.Add('');
|
for i := 0 to FileList.Count - 1 do begin
|
||||||
tmlHighlighter.Free;
|
tmlHighlighter := TSynTextMateSyn.Create(nil);
|
||||||
|
tmlHighlighter.LoadGrammar(FileList[i], '');
|
||||||
|
|
||||||
|
Memo1.Lines.Add(tmlHighlighter.LanguageName);
|
||||||
|
Memo1.Lines.Add('- '+dlgColorsTmlFromFile+' '+FileList[i]);
|
||||||
|
|
||||||
|
if (tmlHighlighter.ParserError <> '') then begin
|
||||||
|
Memo1.Lines.Add('- '+dlgColorsTmlError+' '+tmlHighlighter.ParserError);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
if (tmlHighlighter.TextMateGrammar.SampleText = '') then begin
|
||||||
|
if (tmlHighlighter.TextMateGrammar.SampleTextFile = '') then
|
||||||
|
Memo1.Lines.Add('- '+dlgColorsTmlNoSampleTxt)
|
||||||
|
else
|
||||||
|
if not FileExistsUTF8(TrimAndExpandFilename(tmlHighlighter.TextMateGrammar.SampleTextFile, dir)) then
|
||||||
|
Memo1.Lines.Add('- '+Format(dlgColorsTmlBadSampleTxtFile, [LineEnding+'', tmlHighlighter.TextMateGrammar.SampleTextFile]));
|
||||||
|
end;
|
||||||
|
|
||||||
|
Memo1.Lines.Add('- '+dlgColorsTmlOk);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Memo1.Lines.Add('');
|
||||||
|
tmlHighlighter.Free;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
FileList.Free;
|
||||||
end;
|
end;
|
||||||
FileList.Free;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TTEditorColorOptionsTMLFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
class function TTEditorColorOptionsTMLFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
|
||||||
|
Loading…
Reference in New Issue
Block a user