synedit: dont highlight a line when highlight has not colors set

git-svn-id: trunk@17545 -
This commit is contained in:
paul 2008-11-23 13:06:01 +00:00
parent 177d9aa195
commit 285687c543

View File

@ -46,6 +46,7 @@ type
FHighlightedLine: Integer; FHighlightedLine: Integer;
protected protected
procedure DoMarkupLineHighlightInfoChange(Sender: TObject); procedure DoMarkupLineHighlightInfoChange(Sender: TObject);
function HasLineHighlight: Boolean;
public public
constructor Create(ASynEdit: TCustomControl); constructor Create(ASynEdit: TCustomControl);
destructor Destroy; override; destructor Destroy; override;
@ -77,6 +78,13 @@ begin
InvalidateSynLines(FHighlightedLine, FHighlightedLine); InvalidateSynLines(FHighlightedLine, FHighlightedLine);
end; end;
function TSynEditMarkupSpecialLine.HasLineHighlight: Boolean;
begin
Result :=
(FMarkupLineHighlightInfo.Background <> clNone) or
(FMarkupLineHighlightInfo.Foreground <> clNone);
end;
constructor TSynEditMarkupSpecialLine.Create(ASynEdit: TCustomControl); constructor TSynEditMarkupSpecialLine.Create(ASynEdit: TCustomControl);
begin begin
inherited Create(ASynEdit); inherited Create(ASynEdit);
@ -125,7 +133,7 @@ begin
// if it is so then use own bg,fg colors to setup highlight // if it is so then use own bg,fg colors to setup highlight
if not FSpecialLine then if not FSpecialLine then
begin begin
if FHighlightedLine = ARow then if (FHighlightedLine = ARow) and HasLineHighlight then
begin begin
FSpecialLine := True; FSpecialLine := True;
MarkupInfo.Foreground := FMarkupLineHighlightInfo.Foreground; MarkupInfo.Foreground := FMarkupLineHighlightInfo.Foreground;