SynEdit: Fixed overflow error

git-svn-id: trunk@49283 -
This commit is contained in:
martin 2015-06-06 11:38:01 +00:00
parent f5d76b4807
commit 922e30ce7c

View File

@ -852,7 +852,7 @@ begin
if c = 0 then if c = 0 then
Result := -1 Result := -1
else else
Result := ((ALine - 1) * Height) div c; Result := (Int64(ALine - 1) * Int64(Height)) div c;
end; end;
function TSynGutterLineOverviewProvider.TextLineToPixelEnd(ALine: Integer): Integer; function TSynGutterLineOverviewProvider.TextLineToPixelEnd(ALine: Integer): Integer;
@ -864,8 +864,8 @@ begin
if c = 0 then if c = 0 then
Result := -1 Result := -1
else begin else begin
Result := ((ALine - 1) * Height) div c; Result := (Int64(ALine - 1) * Int64(Height)) div c;
n := ( ALine * Height) div c - 1; // next line - 1 pix n := (Int64(ALine) * Int64(Height)) div c - 1; // next line - 1 pix
if n > Result then if n > Result then
Result := n; Result := n;
end; end;
@ -873,14 +873,14 @@ end;
function TSynGutterLineOverviewProvider.PixelLineToText(ALineIdx: Integer): Integer; function TSynGutterLineOverviewProvider.PixelLineToText(ALineIdx: Integer): Integer;
var var
c: Integer; c: Int64;
begin begin
c := Max(1, TextBuffer.Count); c := Max(1, TextBuffer.Count);
if c = 0 then if c = 0 then
Result := -1 Result := -1
else begin else begin
Result := (ALineIdx * c) div Height + 1; Result := (Int64(ALineIdx) * c) div Height + 1;
if ((Result - 1) * Height) div c <> ALineIdx then if (Int64(Result - 1) * Int64(Height)) div c <> ALineIdx then
inc(Result); inc(Result);
end; end;
end; end;
@ -1359,7 +1359,7 @@ begin
if c = 0 then if c = 0 then
Result := -1 Result := -1
else else
Result := (ALine - 1) * Height div c; Result := Int64(ALine - 1) * Int64(Height) div c;
end; end;
function TSynGutterLineOverview.TextLineToPixelEnd(ALine: Integer): Integer; function TSynGutterLineOverview.TextLineToPixelEnd(ALine: Integer): Integer;
@ -1371,8 +1371,8 @@ begin
if c = 0 then if c = 0 then
Result := -1 Result := -1
else begin else begin
Result := ((ALine - 1) * Height) div c; Result := (Int64(ALine - 1) * Int64(Height)) div c;
n := ( ALine * Height) div c - 1; // next line - 1 pix n := (Int64(ALine) * Int64(Height)) div c - 1; // next line - 1 pix
if n > Result then if n > Result then
Result := n; Result := n;
end; end;