From 4c545919469936b71b28e264b8d2409a4993e64d Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 11 May 2013 12:48:46 +0000 Subject: [PATCH] SynEdit: Fixed folding in "label" code. Issue #0024417 git-svn-id: trunk@41129 - --- components/synedit/synhighlighterpas.pp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/components/synedit/synhighlighterpas.pp b/components/synedit/synhighlighterpas.pp index cf57a5427e..0b907ed63d 100644 --- a/components/synedit/synhighlighterpas.pp +++ b/components/synedit/synhighlighterpas.pp @@ -1003,9 +1003,24 @@ end; function TSynPasSyn.Func32: TtkTokenKind; begin - if KeyComp('Label') then Result := tkKey else - if KeyComp('Mod') then Result := tkKey else - if KeyComp('File') then Result := tkKey else Result := tkIdentifier; + if KeyComp('Label') then begin + if (TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType, cfbtNone, + cfbtProcedure, cfbtProgram, cfbtUnit, cfbtUnitSection]) + then begin + if TopPascalCodeFoldBlockType in [cfbtVarType, cfbtLocalVarType] then + EndPascalCodeFoldBlockLastLine; + if TopPascalCodeFoldBlockType in [cfbtProcedure] + then StartPascalCodeFoldBlock(cfbtLocalVarType) + else StartPascalCodeFoldBlock(cfbtVarType); + end; + Result := tkKey; + end + else + if KeyComp('Mod') then Result := tkKey + else + if KeyComp('File') then Result := tkKey + else + Result := tkIdentifier; end; function TSynPasSyn.Func33: TtkTokenKind;