mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 17:19:25 +02:00
synedit: fixed SetTopLine ScrollWindowEx delta, bug #8479
git-svn-id: trunk@14321 -
This commit is contained in:
parent
ab2ebe4ec9
commit
3339383d3f
@ -26,10 +26,10 @@
|
|||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="2">
|
<RequiredPackages Count="2">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="CodeTools"/>
|
<PackageName Value="LCL"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
<Item2>
|
<Item2>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="CodeTools"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="2">
|
<Units Count="2">
|
||||||
|
@ -5602,6 +5602,9 @@ end;
|
|||||||
procedure TCustomSynEdit.SetTopLine(Value: Integer);
|
procedure TCustomSynEdit.SetTopLine(Value: Integer);
|
||||||
var
|
var
|
||||||
Delta: Integer;
|
Delta: Integer;
|
||||||
|
{$ifdef SYN_LAZARUS}
|
||||||
|
OldTopLine: LongInt;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
// don't use MinMax here, it will fail in design mode (Lines.Count is zero,
|
// don't use MinMax here, it will fail in design mode (Lines.Count is zero,
|
||||||
// but the painting code relies on TopLine >= 1)
|
// but the painting code relies on TopLine >= 1)
|
||||||
@ -5611,13 +5614,12 @@ begin
|
|||||||
Value := Min(Value, Lines.Count + 1 - fLinesInWindow);
|
Value := Min(Value, Lines.Count + 1 - fLinesInWindow);
|
||||||
Value := Max(Value, 1);
|
Value := Max(Value, 1);
|
||||||
if Value <> TopLine then begin
|
if Value <> TopLine then begin
|
||||||
Delta := TopLine - Value;
|
{$ifdef SYN_LAZARUS}
|
||||||
|
OldTopLine:=TopLine;
|
||||||
fTopLine := Value;
|
fTopLine := Value;
|
||||||
UpdateScrollBars;
|
UpdateScrollBars;
|
||||||
|
Delta := TopLine - OldTopLine;
|
||||||
if Abs(Delta) < fLinesInWindow then
|
if Abs(Delta) < fLinesInWindow then
|
||||||
{$ifndef SYN_LAZARUS}
|
|
||||||
ScrollWindow(Handle, 0, fTextHeight * Delta, nil, nil);
|
|
||||||
{$else}
|
|
||||||
begin
|
begin
|
||||||
// TODO: SW_SMOOTHSCROLL --> can't get it work
|
// TODO: SW_SMOOTHSCROLL --> can't get it work
|
||||||
if not ScrollWindowEx(Handle, 0, fTextHeight * Delta, nil, nil, 0, nil,
|
if not ScrollWindowEx(Handle, 0, fTextHeight * Delta, nil, nil, 0, nil,
|
||||||
@ -5627,6 +5629,14 @@ begin
|
|||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
|
{$else}
|
||||||
|
Delta := TopLine - Value;
|
||||||
|
fTopLine := Value;
|
||||||
|
UpdateScrollBars;
|
||||||
|
if Abs(Delta) < fLinesInWindow then
|
||||||
|
begin
|
||||||
|
ScrollWindow(Handle, 0, fTextHeight * Delta, nil, nil);
|
||||||
|
end
|
||||||
{$endif}
|
{$endif}
|
||||||
else
|
else
|
||||||
Invalidate;
|
Invalidate;
|
||||||
|
Loading…
Reference in New Issue
Block a user