SynEdit: PasHighLighter, fix "type" in "class" blocks. Broken in 9db0c4e54e

This commit is contained in:
Martin 2023-12-21 17:32:29 +01:00
parent c4773c0a42
commit cca9327230

View File

@ -1798,10 +1798,13 @@ begin
end;
function TSynPasSyn.Func66: TtkTokenKind;
var
tfb: TPascalCodeFoldBlockType;
begin
if KeyComp('Type') then begin
tfb := TopPascalCodeFoldBlockType;
if (PasCodeFoldRange.BracketNestLevel = 0)
and (TopPascalCodeFoldBlockType in
and (tfb in
[cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram,
cfbtUnit, cfbtUnitSection,
cfbtClass, cfbtClassSection, cfbtRecord // if inside a type section in class/record
@ -1812,11 +1815,14 @@ begin
fRange := fRange + [rsAfterEqualThenType];
end
else begin
if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
if tfb in [cfbtVarType, cfbtLocalVarType] then begin
EndPascalCodeFoldBlockLastLine;
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType);
tfb := TopPascalCodeFoldBlockType;
end;
if not(tfb in [cfbtClass, cfbtClassSection, cfbtRecord]) then
if tfb in [cfbtProcedure, cfbtAnonymousProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType);
fRange := fRange + [rsInTypeBlock];
end;
end;