summaryrefslogtreecommitdiff
path: root/prototypes/textedit
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2009-08-04 20:50:55 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2009-08-04 20:50:55 +0200
commitfa050a42d0c5c2ae2f210b98c932484858762e35 (patch)
treea3caf0e6ca7cb5316bbdccddf32bc596df97de11 /prototypes/textedit
parentb2f678bf4f52b9f766067de2bdc2ca5a620f92ad (diff)
downloadfpGUI-fa050a42d0c5c2ae2f210b98c932484858762e35.tar.xz
TextEdit: implement down arrow navigation support
Signed-off-by: Graeme Geldenhuys <graemeg@gmail.com>
Diffstat (limited to 'prototypes/textedit')
-rw-r--r--prototypes/textedit/fpg_textedit.pas39
1 files changed, 39 insertions, 0 deletions
diff --git a/prototypes/textedit/fpg_textedit.pas b/prototypes/textedit/fpg_textedit.pas
index d076f056..825a682e 100644
--- a/prototypes/textedit/fpg_textedit.pas
+++ b/prototypes/textedit/fpg_textedit.pas
@@ -819,6 +819,45 @@ begin
keyDown:
begin
+ if CaretPos.Y >= FLines.Count then
+ Exit;
+ if not (ssShift in ShiftState) and not (ssCtrl in ShiftState) then
+ begin
+ CaretPos.Y := CaretPos.Y + 1;
+ if FSelected then
+ begin
+ FSelected := False;
+ Exit;
+ end;
+ FSelStartNo := CaretPos.Y;
+ Exit;
+ end
+ else if (ssCtrl in ShiftState) and not (ssShift in ShiftState) then
+ begin
+ CaretPos.Y := CaretPos.Y + 1;
+ {$Note This does not work. The view must scroll and caret pos stay the same. }
+ VScrollBarMove(self, FVScrollBar.Position+1);
+ FSelStartNo := CaretPos.Y;
+ Exit;
+ end
+ else if not (ssCtrl in ShiftState) and (ssShift in ShiftState) then
+ begin
+ CaretPos.Y := CaretPos.Y + 1;
+ if not FSelected then
+ begin
+ FSelStartNo := CaretPos.Y - 1;
+ FSelStartOffs := CaretPos.X;
+ FSelEndNo := CaretPos.Y;
+ FSelEndOffs := CaretPos.X;
+ FSelected := True;
+ end
+ else
+ begin
+ FSelEndNo := CaretPos.Y;
+ FSelEndOffs := CaretPos.X;
+ FSelected := (FSelStartNo <> FSelEndNo) or (FSelStartOffs <> FSelEndOffs);
+ end;
+ end;
end;
keyHome: