mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 19:18:14 +02:00
SynEdit: Return past-end-of line attribute in multi line comments // support for p-eol attibute
git-svn-id: trunk@43419 -
This commit is contained in:
parent
ed2ad8b64b
commit
cb80606ad0
@ -810,7 +810,7 @@ begin
|
||||
case FLineState of
|
||||
0: begin
|
||||
Result := inherited GetNextHighlighterToken(ATokenInfo);
|
||||
if (not Result) and
|
||||
if ( (not Result) or (ATokenInfo.TokenStart = nil)) and
|
||||
(FFoldView.FoldType[CurrentTokenLine + 1 - FFoldView.TopLine] * [cfCollapsedFold, cfCollapsedHide] <> [])
|
||||
then begin
|
||||
inc(FLineState);
|
||||
@ -838,7 +838,7 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
else
|
||||
Result := False;
|
||||
Result := inherited GetNextHighlighterToken(ATokenInfo);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -372,7 +372,7 @@ type
|
||||
function GetRange: Pointer; virtual;
|
||||
function GetToken: String; virtual; abstract;
|
||||
procedure GetTokenEx(out TokenStart: PChar; out TokenLength: integer); virtual; abstract;
|
||||
function GetEndOfLineAttribute: TSynHighlighterAttributes; virtual;
|
||||
function GetEndOfLineAttribute: TSynHighlighterAttributes; virtual; // valid after line was scanned to EOL
|
||||
function GetTokenAttribute: TSynHighlighterAttributes; virtual; abstract;
|
||||
function GetTokenKind: integer; virtual; abstract;
|
||||
function GetTokenPos: Integer; virtual; abstract; // 0-based
|
||||
|
@ -372,7 +372,13 @@ begin
|
||||
FAtLineStart := False;
|
||||
|
||||
Result := not CurrentTokenHighlighter.GetEol;
|
||||
if not Result then exit;
|
||||
if not Result then begin
|
||||
ATokenInfo.TokenStart := nil;
|
||||
ATokenInfo.TokenLength := 0;
|
||||
ATokenInfo.TokenAttr := CurrentTokenHighlighter.GetEndOfLineAttribute;
|
||||
Result := ATokenInfo.TokenAttr <> nil;
|
||||
exit;
|
||||
end;
|
||||
|
||||
CurrentTokenHighlighter.GetTokenEx(ATokenInfo.TokenStart, ATokenInfo.TokenLength);
|
||||
ATokenInfo.TokenAttr := CurrentTokenHighlighter.GetTokenAttribute;
|
||||
|
@ -533,6 +533,7 @@ type
|
||||
procedure SetLine(const NewValue: string; LineNumber: Integer); override;
|
||||
procedure SetRange(Value: Pointer); override;
|
||||
procedure StartAtLineIndex(LineNumber:Integer); override; // 0 based
|
||||
function GetEndOfLineAttribute: TSynHighlighterAttributes; override;
|
||||
|
||||
function UseUserSettings(settingIndex: integer): boolean; override;
|
||||
procedure EnumUserSettings(settings: TStrings); override;
|
||||
@ -3133,6 +3134,14 @@ begin
|
||||
inherited StartAtLineIndex(LineNumber);
|
||||
end;
|
||||
|
||||
function TSynPasSyn.GetEndOfLineAttribute: TSynHighlighterAttributes;
|
||||
begin
|
||||
if fRange * [rsAnsi, rsBor] <> [] then
|
||||
Result := fCommentAttri
|
||||
else
|
||||
Result := inherited GetEndOfLineAttribute;
|
||||
end;
|
||||
|
||||
procedure TSynPasSyn.ResetRange;
|
||||
begin
|
||||
fRange := [];
|
||||
|
@ -1499,6 +1499,26 @@ begin
|
||||
{%endregion}
|
||||
|
||||
|
||||
TstSetText('Simple: fold Prc', TestTextBug21473);
|
||||
FoldedView.FoldAtTextIndex(7);
|
||||
FoldedView.FoldAtTextIndex(11);
|
||||
FoldedView.FoldAtTextIndex(6);
|
||||
FoldedView.FoldAtTextIndex(10);
|
||||
FoldedView.FoldAtTextIndex(4);
|
||||
|
||||
FoldedView.FoldAtTextIndex(22);
|
||||
FoldedView.FoldAtTextIndex(26);
|
||||
FoldedView.FoldAtTextIndex(21);
|
||||
FoldedView.FoldAtTextIndex(25);
|
||||
FoldedView.FoldAtTextIndex(19);
|
||||
|
||||
//FoldedView.debug;
|
||||
|
||||
SynEdit.TextBetweenPoints[point(1,3), point(1,31)] := '';
|
||||
|
||||
DebugLn('#############################');
|
||||
//FoldedView.debug;
|
||||
|
||||
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user