SynEdit: Fixed CollectNodeInfo for cfbtRecordCaseSection / "(" and ")" for fold/markup-able "case in record" had wrong pos/len.

This commit is contained in:
Martin 2024-03-01 21:12:53 +01:00
parent d109bb3725
commit f20e3ef6a6

View File

@ -3914,7 +3914,10 @@ begin
if Run>=fLineLen then begin if Run>=fLineLen then begin
fTokenID:=tkSymbol; fTokenID:=tkSymbol;
if TopPascalCodeFoldBlockType = cfbtRecordCase then begin if TopPascalCodeFoldBlockType = cfbtRecordCase then begin
fStringLen := 1;
Dec(Run);
StartPascalCodeFoldBlock(cfbtRecordCaseSection, True); // TODO: only if case-label attr is set StartPascalCodeFoldBlock(cfbtRecordCaseSection, True); // TODO: only if case-label attr is set
Inc(Run);
PasCodeFoldRange.BracketNestLevel := 0 PasCodeFoldRange.BracketNestLevel := 0
end end
else else
@ -3948,7 +3951,10 @@ begin
begin begin
fTokenID := tkSymbol; fTokenID := tkSymbol;
if TopPascalCodeFoldBlockType = cfbtRecordCase then begin if TopPascalCodeFoldBlockType = cfbtRecordCase then begin
fStringLen := 1;
Dec(Run);
StartPascalCodeFoldBlock(cfbtRecordCaseSection, True); // TODO: only if case-label attr is set StartPascalCodeFoldBlock(cfbtRecordCaseSection, True); // TODO: only if case-label attr is set
Inc(Run);
PasCodeFoldRange.BracketNestLevel := 0; PasCodeFoldRange.BracketNestLevel := 0;
fRange := fRange - [rsVarTypeInSpecification, rsAfterEqual, rsAfterEqualOrColon] + [rsAfterSemiColon]; fRange := fRange - [rsVarTypeInSpecification, rsAfterEqual, rsAfterEqualOrColon] + [rsAfterSemiColon];
end end
@ -3960,13 +3966,13 @@ end;
procedure TSynPasSyn.RoundCloseProc; procedure TSynPasSyn.RoundCloseProc;
begin begin
inc(Run);
fTokenID := tkSymbol; fTokenID := tkSymbol;
fRange := fRange + [rsAfterIdentifierOrValueAdd]; fRange := fRange + [rsAfterIdentifierOrValueAdd];
if (PasCodeFoldRange.BracketNestLevel = 0) and if (PasCodeFoldRange.BracketNestLevel = 0) and
(TopPascalCodeFoldBlockType in [cfbtRecordCase, cfbtRecordCaseSection]) (TopPascalCodeFoldBlockType in [cfbtRecordCase, cfbtRecordCaseSection])
then begin then begin
// End of case-section can close ONE embedded case // End of case-section can close ONE embedded case
fStringLen := 1;
if TopPascalCodeFoldBlockType = cfbtRecordCase then if TopPascalCodeFoldBlockType = cfbtRecordCase then
EndPascalCodeFoldBlock; EndPascalCodeFoldBlock;
if TopPascalCodeFoldBlockType = cfbtRecordCaseSection then if TopPascalCodeFoldBlockType = cfbtRecordCaseSection then
@ -3974,6 +3980,7 @@ begin
end end
else else
PasCodeFoldRange.DecBracketNestLevel; PasCodeFoldRange.DecBracketNestLevel;
inc(Run);
end; end;
procedure TSynPasSyn.SquareOpenProc; procedure TSynPasSyn.SquareOpenProc;