SynEdit: Markup fold color, react to enabled, patch 17 from issue by Pascal R.

git-svn-id: trunk@54028 -
This commit is contained in:
martin 2017-01-29 16:34:36 +00:00
parent 0d6c6db645
commit db30eed726

View File

@ -112,6 +112,7 @@ type
public
constructor Create(ASynEdit : TSynEditBase);
destructor Destroy; override;
procedure BeginMarkup; override;
function GetMarkupAttributeAtRowCol(const aRow: Integer;
const aStartCol: TLazSynDisplayTokenBound;
const {%H-}AnRtlInfo: TLazSynDisplayRtlInfo): TSynSelectedColor; override;
@ -121,7 +122,6 @@ type
out ANextPhys, ANextLog: Integer); override;
procedure PrepareMarkupForRow(aRow : Integer); override;
procedure EndMarkup; override;
property DefaultGroup : integer read FDefaultGroup write SetDefaultGroup;
end;
@ -194,6 +194,17 @@ begin
inherited Destroy;
end;
procedure TSynEditMarkupFoldColors.BeginMarkup;
begin
{$IFDEF SynEditMarkupFoldColoringDebug}
//DebugLn('BeginMarkup');
{$ENDIF}
inherited BeginMarkup;
if not Assigned(FHighlighter) then
exit;
FNestList.Clear; // for next markup start
end;
function TSynEditMarkupFoldColors.GetMarkupAttributeAtRowCol(
const aRow: Integer; const aStartCol: TLazSynDisplayTokenBound;
const AnRtlInfo: TLazSynDisplayRtlInfo): TSynSelectedColor;
@ -573,16 +584,6 @@ begin
end;
end;
procedure TSynEditMarkupFoldColors.EndMarkup;
begin
{$IFDEF SynEditMarkupFoldColoringDebug}
//DebugLn('EndMarkup');
{$ENDIF}
inherited EndMarkup;
if not Assigned(FHighlighter) then exit;
FNestList.Clear; // for next markup start
end;
procedure TSynEditMarkupFoldColors.SetDefaultGroup(AValue: integer);
begin
if FDefaultGroup = AValue then Exit;
@ -696,6 +697,8 @@ begin
if FHighlighter.NeedScan then
exit;
FNestList.Clear;
if EndLine < 0 then
EndLine := StartLine
else
@ -778,7 +781,6 @@ begin
InvalidateSynLines(EndLine + 1 , lEndLine);
end;
FNestList.Clear;
end;
procedure TSynEditMarkupFoldColors.SetLines(const AValue: TSynEditStrings);
@ -867,9 +869,6 @@ procedure TSynEditMarkupFoldColors.HighlightChanged(Sender: TSynEditStrings;
var
newHighlighter: TSynCustomHighlighter;
begin
if not Enabled then
exit;
{$IFDEF SynEditMarkupFoldColoringDebug}
DebugLn(' HighlightChanged: aIndex=%d aCount=%d', [aIndex, aCount]);
{$ENDIF}
@ -890,6 +889,9 @@ begin
FNestList.HighLighter := FHighlighter;
if not Enabled then
exit;
ClearCache;
end;
@ -921,6 +923,8 @@ begin
ClearCache;
end;
end;
if Assigned(Lines) then
InvalidateSynLines(0, Lines.Count - 1);
end;
end.