SynEdit: PasHighLighter, fix empty "type" in "class" blocks followed by class-section

This commit is contained in:
Martin 2023-12-21 17:41:45 +01:00
parent cca9327230
commit 94f76cd340

View File

@ -1467,15 +1467,19 @@ begin
end end
end end
else if KeyComp('Var') then begin else if KeyComp('Var') then begin
if (PasCodeFoldRange.BracketNestLevel = 0) and if (PasCodeFoldRange.BracketNestLevel = 0) then begin
(TopPascalCodeFoldBlockType in if (TopPascalCodeFoldBlockType in
[cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram, [cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram,
cfbtUnit, cfbtUnitSection]) then begin cfbtUnit, cfbtUnitSection])
if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then then begin
EndPascalCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure] EndPascalCodeFoldBlockLastLine;
then StartPascalCodeFoldBlock(cfbtLocalVarType) if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure]
else StartPascalCodeFoldBlock(cfbtVarType); then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType);
end;
fRange := fRange + [rsAfterSemiColon];
FOldRange := FOldRange - [rsAfterSemiColon];
end; end;
Result := tkKey; Result := tkKey;
end end
@ -1823,7 +1827,8 @@ begin
if tfb in [cfbtProcedure, cfbtAnonymousProcedure] if tfb in [cfbtProcedure, cfbtAnonymousProcedure]
then StartPascalCodeFoldBlock(cfbtLocalVarType) then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType); else StartPascalCodeFoldBlock(cfbtVarType);
fRange := fRange + [rsInTypeBlock]; fRange := fRange + [rsInTypeBlock, rsAfterSemiColon];
FOldRange := FOldRange - [rsAfterSemiColon];
end; end;
end; end;
Result := tkKey; Result := tkKey;
@ -1879,15 +1884,19 @@ begin
FRange := FRange + [rsInProcHeader]; FRange := FRange + [rsInProcHeader];
end end
else if KeyComp('Const') then begin else if KeyComp('Const') then begin
if (PasCodeFoldRange.BracketNestLevel = 0) and if (PasCodeFoldRange.BracketNestLevel = 0) then begin
(TopPascalCodeFoldBlockType in if (TopPascalCodeFoldBlockType in
[cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram, [cfbtVarType, cfbtLocalVarType, cfbtNone, cfbtProcedure, cfbtAnonymousProcedure, cfbtProgram,
cfbtUnit, cfbtUnitSection]) then begin cfbtUnit, cfbtUnitSection])
if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then then begin
EndPascalCodeFoldBlockLastLine; if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then
if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure] EndPascalCodeFoldBlockLastLine;
then StartPascalCodeFoldBlock(cfbtLocalVarType) if TopPascalCodeFoldBlockType in [cfbtProcedure, cfbtAnonymousProcedure]
else StartPascalCodeFoldBlock(cfbtVarType); then StartPascalCodeFoldBlock(cfbtLocalVarType)
else StartPascalCodeFoldBlock(cfbtVarType);
end;
fRange := fRange + [rsAfterSemiColon];
FOldRange := FOldRange - [rsAfterSemiColon];
end; end;
Result := tkKey; Result := tkKey;
end end