summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-31 18:51:19 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-31 18:51:19 +0200
commitc1cf10c36fb4119aaa96b8dc58980c64a3182e6e (patch)
tree857b22d1b826e176a4677aaecc9101c600660cef
parentde734718e9fbd342a0312e76ed9ad782057fdcf2 (diff)
downloadfpGUI-c1cf10c36fb4119aaa96b8dc58980c64a3182e6e.tar.xz
textedit: correctly scroll the found text into view.
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas
index 1bb24a62..13ef0272 100644
--- a/examples/apps/ide/src/fpg_textedit.pas
+++ b/examples/apps/ide/src/fpg_textedit.pas
@@ -1376,8 +1376,8 @@ begin
ScrollY := FTopLine * FChrH;
if ((FindPos.x + Length(SrcWord)) * FChrW) - FChrW > GetClientRect.Width then
ScrollX := (FindPos.x * FChrW) - 2 * FChrW;
- if I > (FTopLine + FVisLines - 2) then
- ScrollY := (I-10) * FChrH; // move selection more into the centre
+ if (I < FTopLine) or (I > (FTopLine + FVisLines - 2)) then
+ ScrollY := (I-10) * FChrH; // move selection into view
ScrollTo(ScrollX, ScrollY);
end;
Result := True;
@@ -1458,8 +1458,8 @@ begin
ScrollY := FTopLine * FChrH;
if ((FindPos.x + Length(SrcWord)) * FChrW) - FChrW > GetClientRect.Width then
ScrollX := (FindPos.x * FChrW) - (2 * FChrW);
- if I < (FTopLine -2 ) then
- ScrollY := (I-10) * FChrH; // move selection more into the centre
+ if (I < FTopLine) or (I > (FTopLine + FVisLines - 2)) then
+ ScrollY := (I-10) * FChrH; // move selection into view
ScrollTo(ScrollX, ScrollY);
end;
Result := True;