diff options
-rw-r--r-- | prototypes/textedit/fpg_textedit.pas | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/prototypes/textedit/fpg_textedit.pas b/prototypes/textedit/fpg_textedit.pas index 0adfb821..f1ac2b00 100644 --- a/prototypes/textedit/fpg_textedit.pas +++ b/prototypes/textedit/fpg_textedit.pas @@ -807,6 +807,9 @@ begin if not (ssShift in ShiftState) and not (ssCtrl in ShiftState) then begin CaretPos.Y := CaretPos.Y - 1; + // scroll text + if FVScrollBar.Visible and (CaretPos.Y < FTopLine) then + FVScrollBar.LineUp; if FSelected then begin FSelected := False; @@ -850,7 +853,10 @@ begin if not (ssShift in ShiftState) and not (ssCtrl in ShiftState) then begin CaretPos.Y := CaretPos.Y + 1; - if FSelected then + // scroll text + if FVScrollBar.Visible and (CaretPos.Y > FTopLine+FVisLines-2) then + FVScrollBar.LineDown; + if FSelected then begin FSelected := False; Exit; @@ -1307,13 +1313,12 @@ begin else if CaretPos.X < HPos then ScrollPos_H := CaretPos.X; - if CaretPos.Y < FTopLine then + if CaretPos.Y < (FTopLine+1) then ScrollPos_V := CaretPos.Y - else if CaretPos.Y > FTopLine + FVisLines - 2 then + else if CaretPos.Y > (FTopLine + FVisLines - 2) then ScrollPos_V := CaretPos.Y - FVisLines + 2; Invalidate; - writeln('<< TfpgBaseTextEdit.HandleKeyPress'); end; procedure TfpgBaseTextEdit.HandleKeyChar(var AText: TfpgChar; |