summaryrefslogtreecommitdiff
path: root/examples/apps/ide/src/fpg_textedit.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-31 12:29:29 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-31 12:29:29 +0200
commit7ad7c7836732530d6d86cadf017dfbc59b86ba10 (patch)
tree5506b4c4d002f7618621452f5fef56127b35aee5 /examples/apps/ide/src/fpg_textedit.pas
parent7c3d83224f85aefe71dd8de9ae7393cd0efea27a (diff)
downloadfpGUI-7ad7c7836732530d6d86cadf017dfbc59b86ba10.tar.xz
textedit: searched matches are now scrolled more into the center of visible text
Before the searched results scrolled into view as the first visible line. This doesn't give the developer much context to work with.
Diffstat (limited to 'examples/apps/ide/src/fpg_textedit.pas')
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas
index dac81657..1bb24a62 100644
--- a/examples/apps/ide/src/fpg_textedit.pas
+++ b/examples/apps/ide/src/fpg_textedit.pas
@@ -1373,11 +1373,11 @@ begin
if AllowScroll then
begin
ScrollX := 0;
- ScrollY := (FTopLine * FChrH);
+ 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 * FChrH;
+ ScrollY := (I-10) * FChrH; // move selection more into the centre
ScrollTo(ScrollX, ScrollY);
end;
Result := True;
@@ -1455,11 +1455,11 @@ begin
if AllowScroll then
begin
ScrollX := 0;
- ScrollY := (FTopLine * FChrH);
+ 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 * FChrH;
+ ScrollX := (FindPos.x * FChrW) - (2 * FChrW);
+ if I < (FTopLine -2 ) then
+ ScrollY := (I-10) * FChrH; // move selection more into the centre
ScrollTo(ScrollX, ScrollY);
end;
Result := True;