diff --git a/components/synedit/synhighlighterpas.pp b/components/synedit/synhighlighterpas.pp index 85f1facd5a..30ec5bb971 100644 --- a/components/synedit/synhighlighterpas.pp +++ b/components/synedit/synhighlighterpas.pp @@ -86,6 +86,7 @@ type // Also included after class modifiers "sealed" and "abstract" rsAtClass, rsAfterClass, + rsAfterIdentifier, rsAtClosingBracket, // ')' rsAtCaseLabel, @@ -2750,11 +2751,13 @@ begin fTokenID := tkSymbol; t := TopPascalCodeFoldBlockType; - if (t in PascalStatementBlocks - [cfbtAsm]) or //cfbtClass, cfbtClassSection, - ( ( (t in [cfbtVarType, cfbtLocalVarType]) or - ((t in [cfbtProcedure]) and (PasCodeFoldRange.BracketNestLevel > 0)) - ) and - (fRange * [rsInTypeBlock, rsAfterEqual] = [rsAfterEqual]) ) + if ( (t in PascalStatementBlocks - [cfbtAsm]) or //cfbtClass, cfbtClassSection, + ( ( (t in [cfbtVarType, cfbtLocalVarType]) or + ((t in [cfbtProcedure]) and (PasCodeFoldRange.BracketNestLevel > 0)) + ) and + (fRange * [rsInTypeBlock, rsAfterEqual] = [rsAfterEqual]) + )) and + not(rsAfterIdentifier in fRange) then begin if Run [] then @@ -3082,6 +3086,9 @@ begin if rsAtClass in fRange then fRange := fRange + [rsAfterClass]; end; + + if FTokenID = tkIdentifier then + fRange := fRange + [rsAfterIdentifier]; end end; if FAtLineStart and not(FTokenID in [tkSpace, tkComment, tkIDEDirective]) then diff --git a/components/synedit/test/testhighlightpas.pas b/components/synedit/test/testhighlightpas.pas index 72042529b7..7bdc4bf5c2 100644 --- a/components/synedit/test/testhighlightpas.pas +++ b/components/synedit/test/testhighlightpas.pas @@ -1096,7 +1096,13 @@ begin 'c=^char;', 'begin', 'i:=^f;', - 'end;', // 15 + 'x:=GetTypeData(PropInfo^.PropType{$IFNDEF FPC}^{$ENDIF});', // 15 + 'c:=p^;', + 'c:=p ^;', + 'c:=p(**)^;', + 'c:=p{} ^;', + 'c:=p^+^i''e''^a#13^x;', //20 + 'end;', '' ]); @@ -1120,6 +1126,25 @@ begin CheckTokensForLine('i:=^f', 14, [tkIdentifier, tkSymbol, tkString, tkSymbol]); + CheckTokensForLine('x:=GetTypeData(PropInfo^.PropType{$IFNDEF FPC}^{$ENDIF});', 15, + [tkIdentifier, tkSymbol, tkIdentifier, tkSymbol, // x:=GetTypeData( + tkIdentifier, tkSymbol, tkSymbol, tkIdentifier, // PropInfo^.PropType + tkDirective, tkSymbol, tkDirective, tkSymbol, tkSymbol]); // {$IFNDEF FPC}^{$ENDIF}); + + CheckTokensForLine('c:=p^;', 16, + [tkIdentifier, tkSymbol, tkIdentifier, tkSymbol, tkSymbol]); + CheckTokensForLine('c:=p ^;', 17, + [tkIdentifier, tkSymbol, tkIdentifier, tkSpace, tkSymbol, tkSymbol]); + CheckTokensForLine('c:=p(**)^;', 18, + [tkIdentifier, tkSymbol, tkIdentifier, tkComment, tkSymbol, tkSymbol]); + CheckTokensForLine('c:=p{} ^;', 19, + [tkIdentifier, tkSymbol, tkIdentifier, tkComment, tkSpace, tkSymbol, tkSymbol]); + + CheckTokensForLine('c:=p^+^i''e''^a#13^x;', 20, + [tkIdentifier, tkSymbol, tkIdentifier, tkSymbol, tkSymbol, // c:=p^+ + tkString, tkString, tkString, tkString, tkString, tkSymbol // ^i'e'^a#13^x; + ]); + end; procedure TTestHighlighterPas.TestFoldNodeInfo;