summaryrefslogtreecommitdiff
path: root/prototypes
diff options
context:
space:
mode:
Diffstat (limited to 'prototypes')
-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: