diff options
-rw-r--r-- | examples/apps/ide/src/fpg_textedit.pas | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas index b3a1642c..e63eb09b 100644 --- a/examples/apps/ide/src/fpg_textedit.pas +++ b/examples/apps/ide/src/fpg_textedit.pas @@ -1425,12 +1425,36 @@ begin CaretScroll := True; consumed := True; end; - end; - if CaretPos.X > HPos + FVisCols then - ScrollPos_H := CaretPos.X - FVisCols - else if CaretPos.X < HPos then - ScrollPos_H := CaretPos.X; + keyDelete: + begin + if FSelected then + begin + DeleteSelection; + consumed := True; + Exit; + end; + if CaretPos.Y > pred(FLines.Count) then + Exit; + SLine := FLines[CaretPos.Y]; + if Length(SLine) >= CaretPos.X + 1 then + begin + X := CaretPos.X + 1; + Delete(SLine, X, 1); + FLines[CaretPos.Y] := SLine; + end + else + begin + if CaretPos.Y + 1 > pred(FLines.Count) then + Exit; + AddS := FLines[CaretPos.Y + 1]; + FLines[CaretPos.Y] := SLine + AddS; + FLines.Delete(CaretPos.Y + 1); + DrawVisible; + end; + consumed := True; + end; + end; if CaretScroll then begin |