Browse Source

Fix Ctrl-k b mark beginning of select, Ctrl-k k end select.

Margers 1 month ago
parent
commit
7dfa763e67
1 changed files with 9 additions and 6 deletions
  1. 9 6
      packages/ide/weditor.pas

+ 9 - 6
packages/ide/weditor.pas

@@ -3777,7 +3777,10 @@ begin
               PrevP:=P;
               if PointOfs(P)<PointOfs(StartP)
                  then SetSelection(P,StartP)
-                 else SetSelection(StartP,P);
+              else if PointOfs(P)>PointOfs(StartP)
+                 then SetSelection(StartP,P)
+              else if PointOfs(SelStart)<>PointOfs(SelEnd) { if selected only then remove selection }
+                 then SetSelection(StartP,P);
               DrawView;
               UnLock;
             end;
@@ -5653,14 +5656,14 @@ end;
 
 procedure TCustomCodeEditor.EndSelect;
 var P: TPoint;
-    LS: sw_integer;
+   { LS: sw_integer;}
 begin
   P:=CurPos;
-{  P.X:=Min(SelEnd.X,length(GetLineText(SelEnd.Y)));}
-  LS:=length(GetLineText(SelEnd.Y));
-  if LS<P.X then P.X:=LS;
-  CheckSels;
+  { don't try to jump to end of line, not for now
+  LS:=length(GetLineText(P.Y));
+  if LS<P.X then P.X:=LS; }
   SetSelection(SelStart,P);
+  CheckSels;
   DrawView;
 end;