mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 02:20:39 +02:00
SynEdit Mouselinks: fixed highlight offset for utf8 chars
git-svn-id: trunk@17817 -
This commit is contained in:
parent
4ec7c62a72
commit
8a4d01af77
@ -37,10 +37,12 @@ type
|
||||
FCtrlMouseLine: Integer;
|
||||
FCtrlMouseX1: Integer;
|
||||
FCtrlMouseX2: Integer;
|
||||
FCurX1, FCurX2: Integer;
|
||||
public
|
||||
constructor Create(ASynEdit: TCustomControl);
|
||||
|
||||
Procedure EndMarkup; override;
|
||||
Procedure PrepareMarkupForRow(aRow: Integer); override;
|
||||
Function GetMarkupAttributeAtRowCol(const aRow, aCol: Integer) : TSynSelectedColor; override;
|
||||
Function GetNextMarkupColAfterRowCol(const aRow, aCol: Integer) : Integer; override;
|
||||
|
||||
@ -82,10 +84,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSynEditMarkupCtrlMouseLink.PrepareMarkupForRow(aRow: Integer);
|
||||
begin
|
||||
inherited PrepareMarkupForRow(aRow);
|
||||
if aRow = FCtrlMouseLine then begin
|
||||
FCurX1 := LogicalToPhysicalPos(Point(FCtrlMouseX1, FCtrlMouseLine)).x;
|
||||
FCurX2 := LogicalToPhysicalPos(Point(FCtrlMouseX2, FCtrlMouseLine)).x;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TSynEditMarkupCtrlMouseLink.GetMarkupAttributeAtRowCol(const aRow, aCol: Integer) : TSynSelectedColor;
|
||||
begin
|
||||
Result := nil;
|
||||
if (aRow <> FCtrlMouseLine) or ((aCol < FCtrlMouseX1) or (aCol >= FCtrlMouseX2))
|
||||
if (aRow <> FCtrlMouseLine) or ((aCol < FCurX1) or (aCol >= FCurX2))
|
||||
then exit;
|
||||
Result := MarkupInfo;
|
||||
end;
|
||||
@ -96,10 +107,10 @@ begin
|
||||
if FCtrlMouseLine <> aRow
|
||||
then exit;
|
||||
|
||||
if aCol < FCtrlMouseX1
|
||||
then Result := FCtrlMouseX1;
|
||||
if (aCol < FCtrlMouseX2) and (aCol >= FCtrlMouseX1)
|
||||
then Result := FCtrlMouseX2;
|
||||
if aCol < FCurX1
|
||||
then Result := FCurX1;
|
||||
if (aCol < FCurX2) and (aCol >= FCurX1)
|
||||
then Result := FCurX2;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user