summaryrefslogtreecommitdiff
path: root/examples/apps
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-29 22:06:23 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-29 22:19:03 +0200
commit2f5e0819e628accbd525d5a727aaf92c31a83247 (patch)
tree7b7f2fc301c2a2a8067fed263d972d89edb96ec2 /examples/apps
parent0a256264e5d4d75f6fa0c5d81aeb96222f7c1273 (diff)
downloadfpGUI-2f5e0819e628accbd525d5a727aaf92c31a83247.tar.xz
textedit: implemented keyDelete handling.
Diffstat (limited to 'examples/apps')
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas34
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