SynEdit: PascalBeautifier, fix continue-string-on-next-line. The new "custom words" in string can break up the token, which stopped the beautifier from finding the start of the string.

This commit is contained in:
Martin 2025-07-06 01:33:01 +02:00
parent fdadec0c67
commit 079a0f8eb5
2 changed files with 7 additions and 0 deletions

View File

@ -407,6 +407,7 @@ begin
FCacheLastHlTokenCol := -1;
if (CurrentLines[AIndex] <> '') then begin
FPasHighlighter.StartAtLineIndex(AIndex);
FPasHighlighter.SetIsInNextToEOL;
while not FPasHighlighter.GetEol do begin
FCacheLastHlTokenKind := TtkTokenKind(FPasHighlighter.GetTokenKind);
FCacheLastHlTokenCol := FPasHighlighter.GetTokenPos + 1;

View File

@ -980,6 +980,7 @@ type
function GetTokenIsCommentEnd: Boolean;
function IsKeyword(const AKeyword: string): boolean; override;
procedure Next; override;
procedure SetIsInNextToEOL; experimental; // scan without extra colors
procedure ResetRange; override;
procedure SetLine(const NewValue: string; LineNumber: Integer); override;
@ -5524,6 +5525,11 @@ begin
//DebugLn('TSynPasSyn.Next Run=%2d TkPos=%2d %12s Tk="%s" -- TS=%s Rng=%s F=%s ()=%d', [Run, fTokenPos, dbgs(FTokenID), GetToken, dbgs(FTokenState), dbgs(fRange), dbgs(TopPascalCodeFoldBlockType), PasCodeFoldRange.BracketNestLevel]);
end;
procedure TSynPasSyn.SetIsInNextToEOL;
begin
FIsInNextToEOL := True;
end;
function TSynPasSyn.GetDefaultAttribute(Index: integer):
TSynHighlighterAttributes;
begin