Browse Source

* "AdjustRangeToCursor" now is called after each pressed key

sg 25 years ago
parent
commit
49ffc2422a
1 changed files with 26 additions and 34 deletions
  1. 26 34
      fcl/shedit/keys.inc

+ 26 - 34
fcl/shedit/keys.inc

@@ -97,70 +97,60 @@ end;
 
 
 procedure TSHTextEdit.CursorUp;
 procedure TSHTextEdit.CursorUp;
 begin
 begin
-  if FCursorY>0 then
-   dec(FCursorY);
-  AdjustRangeToCursor;
+  if FCursorY > 0 then
+    Dec(FCursorY);
 end;
 end;
 
 
 
 
 procedure TSHTextEdit.CursorDown;
 procedure TSHTextEdit.CursorDown;
 begin
 begin
-  if FCursorY<FDoc.LineCount-1 then
-   inc(FCursorY);
-  AdjustRangeToCursor;
+  if FCursorY < FDoc.LineCount - 1 then
+    Inc(FCursorY);
 end;
 end;
 
 
 
 
 procedure TSHTextEdit.CursorLeft;
 procedure TSHTextEdit.CursorLeft;
 begin
 begin
-  dec(FCursorX);
+  Dec(FCursorX);
   if FCursorX < 0 then
   if FCursorX < 0 then
-   begin
-     if FCursorY>0 then
-      begin
-        dec(FCursorY);
-        FCursorX:=FDoc.LineLen[FCursorY];
-      end
-     else
-      FCursorX:=0;
-   end;
-  AdjustRangeToCursor;
+    if FCursorY>0 then begin
+      Dec(FCursorY);
+      FCursorX := FDoc.LineLen[FCursorY];
+    end else
+      FCursorX := 0;
 end;
 end;
 
 
 
 
 procedure TSHTextEdit.CursorRight;
 procedure TSHTextEdit.CursorRight;
 begin
 begin
-  inc(FCursorX);
-  AdjustRangeToCursor;
+  Inc(FCursorX);
 end;
 end;
 
 
 
 
 procedure TSHTextEdit.CursorDocBegin;
 procedure TSHTextEdit.CursorDocBegin;
 begin
 begin
-  FCursorX:=0;
-  FCursorY:=0;
-  AdjustRangeToCursor;
+  FCursorX := 0;
+  FCursorY := 0;
 end;
 end;
 
 
 
 
 procedure TSHTextEdit.CursorDocEnd;
 procedure TSHTextEdit.CursorDocEnd;
 begin
 begin
-  FCursorY:=FDoc.LineCount-1;
-  FCursorX:=FDoc.LineLen[FCursorY];
-  AdjustRangeToCursor;
+  FCursorY := FDoc.LineCount-1;
+  FCursorX := FDoc.LineLen[FCursorY];
 end;
 end;
 
 
 
 
 procedure TSHTextEdit.CursorHome;
 procedure TSHTextEdit.CursorHome;
 begin
 begin
-  FCursorX:=0;
+  FCursorX := 0;
   AdjustRangeToCursor;
   AdjustRangeToCursor;
 end;
 end;
 
 
 
 
 procedure TSHTextEdit.CursorEnd;
 procedure TSHTextEdit.CursorEnd;
 begin
 begin
-  FCursorX:=FDoc.LineLen[FCursorY];
+  FCursorX := FDoc.LineLen[FCursorY];
   AdjustRangeToCursor;
   AdjustRangeToCursor;
 end;
 end;
 
 
@@ -168,18 +158,16 @@ end;
 procedure TSHTextEdit.CursorPageUp;
 procedure TSHTextEdit.CursorPageUp;
 begin
 begin
   Dec(FCursorY, FWidget.PageHeight);
   Dec(FCursorY, FWidget.PageHeight);
-  if FCursorY<0 then
-    FCursorY:=0;
-  AdjustRangeToCursor;
+  if FCursorY < 0 then
+    FCursorY := 0;
 end;
 end;
 
 
 
 
 procedure TSHTextEdit.CursorPageDown;
 procedure TSHTextEdit.CursorPageDown;
 begin
 begin
   Inc(FCursorY, FWidget.PageHeight);
   Inc(FCursorY, FWidget.PageHeight);
-  if FCursorY > FDoc.LineCount-1 then
-    FCursorY:=FDoc.LineCount-1;
-  AdjustRangeToCursor;
+  if FCursorY > FDoc.LineCount - 1 then
+    FCursorY := FDoc.LineCount - 1;
 end;
 end;
 
 
 
 
@@ -497,12 +485,16 @@ begin
       Result := False;		// Key has not been processed
       Result := False;		// Key has not been processed
 
 
   EndSelectionChange;
   EndSelectionChange;
+  AdjustRangeToCursor;
 end;
 end;
 
 
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2000-01-23 23:58:25  sg
+  Revision 1.12  2000-02-22 14:28:35  sg
+  * "AdjustRangeToCursor" now is called after each pressed key
+
+  Revision 1.11  2000/01/23 23:58:25  sg
   * KeyPressed now returns a Boolean which indicates if the key has been
   * KeyPressed now returns a Boolean which indicates if the key has been
     processed or not
     processed or not