SynEdit: remove circular dependency between SynEdit and SynEditMarkupHighAll

git-svn-id: trunk@64483 -
This commit is contained in:
ondrej 2021-02-05 13:26:18 +00:00
parent 608ef7b4c6
commit 454ff7cfe4
3 changed files with 10 additions and 10 deletions

View File

@ -986,7 +986,7 @@ type
out Attri: TSynHighlighterAttributes): boolean; //L505 out Attri: TSynHighlighterAttributes): boolean; //L505
procedure CaretAtIdentOrString(XY: TPoint; out AtIdent, NearString: Boolean); procedure CaretAtIdentOrString(XY: TPoint; out AtIdent, NearString: Boolean);
procedure GetWordBoundsAtRowCol(const XY: TPoint; out StartX, EndX: integer); override; procedure GetWordBoundsAtRowCol(const XY: TPoint; out StartX, EndX: integer); override;
function GetWordAtRowCol(XY: TPoint): string; function GetWordAtRowCol(XY: TPoint): string; override;
function NextTokenPos: TPoint; virtual; deprecated; // use next word pos instead function NextTokenPos: TPoint; virtual; deprecated; // use next word pos instead
function NextWordPos: TPoint; virtual; function NextWordPos: TPoint; virtual;
function PrevWordPos: TPoint; virtual; function PrevWordPos: TPoint; virtual;

View File

@ -440,7 +440,6 @@ type
end; end;
implementation implementation
uses SynEdit;
const const
SEARCH_START_OFFS = 100; // Search n lises before/after visible area. (Before applies only, if no exact offset can not be calculated from searchtext) SEARCH_START_OFFS = 100; // Search n lises before/after visible area. (Before applies only, if no exact offset can not be calculated from searchtext)
@ -2726,27 +2725,27 @@ begin
exit(''); exit('');
if FToggledWord <> '' then if FToggledWord <> '' then
exit(FToggledWord); exit(FToggledWord);
If TCustomSynEdit(SynEdit).SelAvail then begin If SynEdit.SelAvail then begin
LowBnd := TCustomSynEdit(SynEdit).BlockBegin; LowBnd := SynEdit.BlockBegin;
UpBnd := TCustomSynEdit(SynEdit).BlockEnd; UpBnd := SynEdit.BlockEnd;
i := UpBnd.y - LowBnd.y + 1; i := UpBnd.y - LowBnd.y + 1;
if (i > LowBnd.y) and (i > Lines.Count - UpBnd.y) then if (i > LowBnd.y) and (i > Lines.Count - UpBnd.y) then
exit(''); exit('');
if FTrim then if FTrim then
Result := TrimS(TCustomSynEdit(SynEdit).SelText) Result := TrimS(SynEdit.SelText)
else else
Result := TCustomSynEdit(SynEdit).SelText; Result := SynEdit.SelText;
if TrimS(Result) = '' then Result := ''; if TrimS(Result) = '' then Result := '';
FLowBound := LowBnd; FLowBound := LowBnd;
FUpBound := UpBnd; FUpBound := UpBnd;
end else begin end else begin
Result := TCustomSynEdit(SynEdit).GetWordAtRowCol(Caret.LineBytePos); Result := SynEdit.GetWordAtRowCol(Caret.LineBytePos);
if FIgnoreKeywords and assigned(FHighlighter) if FIgnoreKeywords and assigned(FHighlighter)
and FHighlighter.IsKeyword(Result) then and FHighlighter.IsKeyword(Result) then
Result := ''; Result := '';
FLowBound.Y := Caret.LinePos; FLowBound.Y := Caret.LinePos;
FUpBound.Y := Caret.LinePos; FUpBound.Y := Caret.LinePos;
TCustomSynEdit(SynEdit).GetWordBoundsAtRowCol(Caret.LineBytePos, FLowBound.X, FUpBound.X); SynEdit.GetWordBoundsAtRowCol(Caret.LineBytePos, FLowBound.X, FUpBound.X);
end; end;
end; end;
@ -2762,7 +2761,7 @@ function TSynEditMarkupHighlightAllCaret.GetCurrentOption: TSynSearchOptions;
begin begin
if FToggledWord <> '' then if FToggledWord <> '' then
exit(FToggledOption); exit(FToggledOption);
If TCustomSynEdit(SynEdit).SelAvail or not(FFullWord) then If SynEdit.SelAvail or not(FFullWord) then
Result := [] Result := []
else else
if (FFullWordMaxLen >0) and (UTF8Length(GetCurrentText) > FFullWordMaxLen) then if (FFullWordMaxLen >0) and (UTF8Length(GetCurrentText) > FFullWordMaxLen) then

View File

@ -217,6 +217,7 @@ type
function TextXYToScreenXY(APhysTextXY: TPhysPoint): TPhysPoint; virtual; abstract; function TextXYToScreenXY(APhysTextXY: TPhysPoint): TPhysPoint; virtual; abstract;
procedure GetWordBoundsAtRowCol(const XY: TPoint; out StartX, EndX: integer); virtual; abstract; procedure GetWordBoundsAtRowCol(const XY: TPoint; out StartX, EndX: integer); virtual; abstract;
function GetWordAtRowCol(XY: TPoint): string; virtual; abstract;
// Cursor // Cursor
procedure UpdateCursorOverride; virtual; abstract; procedure UpdateCursorOverride; virtual; abstract;