SynEdit: fix pixel to char, outside textarea

git-svn-id: trunk@53023 -
This commit is contained in:
martin 2016-09-24 00:06:01 +00:00
parent 2cebdc3bf8
commit 2094de32dc

View File

@ -1206,10 +1206,14 @@ function TLazSynTextArea.PixelsToRowColumn(Pixels: TPoint;
aFlags: TSynCoordinateMappingFlags): TPoint;
begin
// Inludes LeftChar, but not Topline
if not (scmForceLeftSidePos in aFlags) then
Pixels.X := Pixels.X + (CharWidth div 2); // nearest side of char
Result.X := (Pixels.X - FTextBounds.Left) div CharWidth
+ LeftChar;
if (Pixels.X >= FTextBounds.Left) and (Pixels.X < FTextBounds.Right) then begin
if not (scmForceLeftSidePos in aFlags) then
Pixels.X := Pixels.X + (CharWidth div 2); // nearest side of char
Result.X := (Pixels.X - FTextBounds.Left) div CharWidth
+ LeftChar;
end
else
Result.X := 0;
Result.Y := (Pixels.Y - FTextBounds.Top) div LineHeight;
if (not(scmIncludePartVisible in aFlags)) and (Result.Y >= LinesInWindow) then begin