SynEdit: Change CaretXPix/YPix to use ScreenXYToPixels, TextXYToScreenXY

git-svn-id: trunk@63271 -
This commit is contained in:
martin 2020-06-02 00:37:19 +00:00
parent 253d7c2d02
commit 9566494312

View File

@ -2852,13 +2852,18 @@ function TCustomSynEdit.CaretXPix: Integer;
var var
p: TPoint; p: TPoint;
begin begin
p := Point(CaretX, CaretY); p := FCaret.ViewedLineCharPos;
Result := RowColumnToPixels(p).X; p.y := p.y - TopView + 1;
Result := ScreenXYToPixels(p).X;
end; end;
function TCustomSynEdit.CaretYPix: Integer; function TCustomSynEdit.CaretYPix: Integer;
var
p: TPoint;
begin begin
Result := RowColumnToPixels(Point(1, CaretY)).Y; p := FCaret.ViewedLineCharPos;
p.y := p.y - TopView + 1;
Result := ScreenXYToPixels(p).Y;
end; end;
procedure TCustomSynEdit.FontChanged(Sender: TObject); procedure TCustomSynEdit.FontChanged(Sender: TObject);
@ -5049,7 +5054,7 @@ end;
procedure TCustomSynEdit.UpdateCaret(IgnorePaintLock: Boolean = False); procedure TCustomSynEdit.UpdateCaret(IgnorePaintLock: Boolean = False);
var var
x, y: Integer; p: TPoint;
begin begin
if ( (PaintLock <> 0) and not IgnorePaintLock ) or (not HandleAllocated) if ( (PaintLock <> 0) and not IgnorePaintLock ) or (not HandleAllocated)
then begin then begin
@ -5059,9 +5064,9 @@ begin
if eoAlwaysVisibleCaret in fOptions2 then if eoAlwaysVisibleCaret in fOptions2 then
MoveCaretToVisibleArea; MoveCaretToVisibleArea;
x := CaretXPix; p := FCaret.ViewedLineCharPos;
y := CaretYPix; p.y := p.y - TopView + 1;
FScreenCaret.DisplayPos := Point(x, y); FScreenCaret.DisplayPos := ScreenXYToPixels(p);
end; end;
end; end;