summaryrefslogtreecommitdiff
path: root/examples/apps/ide
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-29 22:00:16 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-29 22:19:02 +0200
commit6ad002ca19ef132e1c707036b3ccd7f7450e868d (patch)
tree6e0d709798bd1b8900707cd162b1df8b31b0bdaf /examples/apps/ide
parent7c05e9cc3c00654a283cfb782efafd84c42b7df7 (diff)
downloadfpGUI-6ad002ca19ef132e1c707036b3ccd7f7450e868d.tar.xz
textedit: wrapped caret related code with a if statement.
micro optimization.
Diffstat (limited to 'examples/apps/ide')
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas17
1 files changed, 13 insertions, 4 deletions
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas
index 456ae75f..e2c6992c 100644
--- a/examples/apps/ide/src/fpg_textedit.pas
+++ b/examples/apps/ide/src/fpg_textedit.pas
@@ -1309,6 +1309,7 @@ begin
{$IFDEF gDEBUG}
writeln('>> TfpgBaseTextEdit.HandleKeyPress');
{$ENDIF}
+ CaretScroll := False;
// inherited HandleKeyPress(keycode, shiftstate, consumed);
case CheckClipboardKey(keycode, shiftstate) of
ckCopy:
@@ -1430,10 +1431,18 @@ begin
else if CaretPos.X < HPos then
ScrollPos_H := CaretPos.X;
- if CaretPos.Y < (FTopLine+1) then
- ScrollPos_V := CaretPos.Y
- else if CaretPos.Y > (FTopLine + FVisLines - 2) then
- ScrollPos_V := CaretPos.Y - FVisLines + 2;
+ if CaretScroll then
+ begin
+ if CaretPos.X > HPos + FVisCols then
+ ScrollPos_H := CaretPos.X - FVisCols
+ else if CaretPos.X < HPos then
+ ScrollPos_H := CaretPos.X;
+
+ if CaretPos.Y < (FTopLine+1) then
+ ScrollPos_V := CaretPos.Y
+ else if CaretPos.Y > (FTopLine + FVisLines - 2) then
+ ScrollPos_V := CaretPos.Y - FVisLines + 2;
+ end;
Invalidate;
{$IFDEF gDEBUG}