mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 14:09:26 +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>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="CodeTools"/>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
<PackageName Value="CodeTools"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
|
@ -5602,6 +5602,9 @@ end;
|
||||
procedure TCustomSynEdit.SetTopLine(Value: Integer);
|
||||
var
|
||||
Delta: Integer;
|
||||
{$ifdef SYN_LAZARUS}
|
||||
OldTopLine: LongInt;
|
||||
{$ENDIF}
|
||||
begin
|
||||
// don't use MinMax here, it will fail in design mode (Lines.Count is zero,
|
||||
// but the painting code relies on TopLine >= 1)
|
||||
@ -5611,13 +5614,12 @@ begin
|
||||
Value := Min(Value, Lines.Count + 1 - fLinesInWindow);
|
||||
Value := Max(Value, 1);
|
||||
if Value <> TopLine then begin
|
||||
Delta := TopLine - Value;
|
||||
{$ifdef SYN_LAZARUS}
|
||||
OldTopLine:=TopLine;
|
||||
fTopLine := Value;
|
||||
UpdateScrollBars;
|
||||
Delta := TopLine - OldTopLine;
|
||||
if Abs(Delta) < fLinesInWindow then
|
||||
{$ifndef SYN_LAZARUS}
|
||||
ScrollWindow(Handle, 0, fTextHeight * Delta, nil, nil);
|
||||
{$else}
|
||||
begin
|
||||
// TODO: SW_SMOOTHSCROLL --> can't get it work
|
||||
if not ScrollWindowEx(Handle, 0, fTextHeight * Delta, nil, nil, 0, nil,
|
||||
@ -5627,6 +5629,14 @@ begin
|
||||
Invalidate;
|
||||
end;
|
||||
end
|
||||
{$else}
|
||||
Delta := TopLine - Value;
|
||||
fTopLine := Value;
|
||||
UpdateScrollBars;
|
||||
if Abs(Delta) < fLinesInWindow then
|
||||
begin
|
||||
ScrollWindow(Handle, 0, fTextHeight * Delta, nil, nil);
|
||||
end
|
||||
{$endif}
|
||||
else
|
||||
Invalidate;
|
||||
|
Loading…
Reference in New Issue
Block a user