SynEdit: FoldedView, fix modifier "enumerator"

This commit is contained in:
Martin 2025-03-09 22:16:31 +01:00
parent e11d2d5969
commit 37a7a053b1
2 changed files with 27 additions and 3 deletions

View File

@ -2963,8 +2963,16 @@ begin
if (FStringKeywordMode in [spsmDefault]) and KeyComp('Ansistring') then
Result := tkKey
else
if KeyComp('Enumerator') and (TopPascalCodeFoldBlockType in [cfbtClassSection]) then
Result := tkModifier
if (PasCodeFoldRange.BracketNestLevel = 0) and
(fRange * [rsAfterClassMembers, rsAfterSemiColon, rsAfterEqualOrColon, rsInProcHeader, rsProperty] =
[rsAfterClassMembers, rsAfterSemiColon]) and
KeyComp('Enumerator') and
(TopPascalCodeFoldBlockType in [cfbtClass, cfbtClassSection, cfbtRecord])
then begin
Result := tkModifier;
if rsWasInProcHeader in fRange then
FRange := FRange + [rsInProcHeader];
end
else
Result := tkIdentifier;
end;

View File

@ -2583,6 +2583,7 @@ begin
6: n := 'message';
7: n := 'platform';
8: n := 'overload';
9: n := 'enumerator'; // "enumerator current" or "enumerator MoveNext"
end;
SetLines
@ -2636,6 +2637,9 @@ begin
'procedure '+n+'('+n+':'+n+');'+n+';',
'function '+n+':'+n+';'+n+';',
'function '+n+'('+n+':'+n+'):'+n+';'+n+';',
// 41
'function '+n+'('+n+':'+n+'):'+n+';enumerator MoveNext;'+n+';',
'property '+n+':'+n+' read '+n+';enumerator Current;deprecated;',
'end;',
''
]);
@ -2791,7 +2795,19 @@ begin
tkIdentifier, TK_Semi,
tkModifier, TK_Semi
]);
// 41
CheckTokensForLine('function '+n+'('+n+':'+n+'):'+n+';enumerator MoveNext;'+n+';',41,
[tkKey, tkSpace, tkIdentifier+h,
TK_Bracket, tkIdentifier, TK_Comma, tkIdentifier, TK_Bracket, TK_Colon, tkIdentifier, TK_Semi,
tkModifier, tkSpace, tkIdentifier, TK_Semi,
tkModifier, TK_Semi
]);
CheckTokensForLine('property '+n+':'+n+' read '+n+';enumerator Current;deprecated;',42,
[tkKey, tkSpace, tkIdentifier,
TK_Colon, tkIdentifier, tkSpace, tkKey, tkSpace, tkIdentifier, TK_Semi,
tkModifier, tkSpace, tkIdentifier, TK_Semi,
tkModifier, TK_Semi
]);
end;
end;
end;