Kaynağa Gözat

Merged revisions 9448-9456,9459-9463,9466,9468-9469,9472-9473,9476-9477,9480,9491-9492,9529,9536,9550,9566-9568,9571,9573,9576-9577,9579,9583,9587,9632-9637,9655-9656,9658,9692,9694-9695,9697-9714,9720,9722,9729,9732-9733,9740,9745,9749-9750,9753-9757,9760-9766,9768-9770,9772-9774,9779 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r9448 | florian | 2007-12-14 22:44:21 +0100 (Fri, 14 Dec 2007) | 2 lines

* properly delete last line, resolves #10283
........
r9449 | florian | 2007-12-15 12:24:11 +0100 (Sat, 15 Dec 2007) | 2 lines

* fixed undo for delstart/delend
........
r9779 | peter | 2008-01-17 20:58:32 +0100 (Thu, 17 Jan 2008) | 2 lines

* use UpdateCrc32 instead of Crc32
........

git-svn-id: branches/fixes_2_2@9846 -

peter 17 yıl önce
ebeveyn
işleme
4e1a4d5edf
3 değiştirilmiş dosya ile 31 ekleme ve 9 silme
  1. 2 1
      ide/fpini.pas
  2. 2 5
      ide/wcedit.pas
  3. 27 3
      ide/weditor.pas

+ 2 - 1
ide/fpini.pas

@@ -430,7 +430,8 @@ begin
   AltMouseAction:=INIFile^.GetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
   CtrlMouseAction:=INIFile^.GetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
   {Keyboard}
-  case crc32(upcase(INIFile^.GetEntry(secKeyboard,ieEditKeys,''))) of
+  S:=upcase(INIFile^.GetEntry(secKeyboard,ieEditKeys,''));
+  case UpdateCrc32(0,s[1],Length(s)) of
     $86a4c898: {crc32 for 'MICROSOFT'}
       EditKeys:=ekm_microsoft;
     $b20b87b3: {crc32 for 'BORLAND'}

+ 2 - 5
ide/wcedit.pas

@@ -1378,13 +1378,11 @@ begin
               end;
             eaDeleteLine :
               begin
-                SetCurPtr(EndPos.X,EndPos.Y);
-                SetMinMax(EndPos.Y);
                 HadefNoIndent:=(GetFlags and efNoIndent)<>0;
                 WasInserting:=GetInsertMode;
                 SetInsertMode(true);
                 SetFlags(GetFlags or efNoIndent);
-                InsertNewLine;
+                InsertLine(StartPos.Y,'');
                 SetInsertMode(WasInserting);
                 if not HadefNoIndent then
                   SetFlags(GetFlags and not efNoIndent);
@@ -2062,5 +2060,4 @@ begin
 {$endif}
 end;
 
-
-END.
+end.

+ 27 - 3
ide/weditor.pas

@@ -3537,7 +3537,7 @@ begin
           cmBackSpace   : BackSpace;
           cmDelChar     : DelChar;
           cmDelWord     : DelWord;
-       cmDelToEndOfWord : DelToEndOfWord;
+          cmDelToEndOfWord : DelToEndOfWord;
           cmDelStart    : DelStart;
           cmDelEnd      : DelEnd;
           cmDelLine     : DelLine;
@@ -5009,35 +5009,59 @@ end;
 
 procedure TCustomCodeEditor.DelStart;
 var S: string;
+    OI: Sw_integer;
+    HoldUndo : Boolean;
+    SCP : TPoint;
 begin
   if IsReadOnly then Exit;
   Lock;
+  HoldUndo:=GetStoreUndo;
+  SetStoreUndo(false);
+  SCP:=CurPos;
   S:=GetLineText(CurPos.Y);
   if (S<>'') and (CurPos.X<>0) then
   begin
-    SetLineText(CurPos.Y,copy(S,LinePosToCharIdx(CurPos.Y,CurPos.X),High(S)));
+    OI:=LinePosToCharIdx(CurPos.Y,CurPos.X);
+    SetLineText(CurPos.Y,copy(S,OI,High(S)));
     SetCurPtr(0,CurPos.Y);
+    SetStoreUndo(HoldUndo);
+    Addaction(eaDeleteText,SCP,CurPos,copy(S,1,OI-1),GetFlags);
+    SetStoreUndo(false);
+    AdjustSelectionPos(CurPos.X,CurPos.Y,-length(copy(S,1,OI-1)),0);
     UpdateAttrs(CurPos.Y,attrAll);
     DrawLines(CurPos.Y);
     SetModified(true);
   end;
+  SetStoreUndo(HoldUndo);
   Unlock;
 end;
 
 procedure TCustomCodeEditor.DelEnd;
 var S: string;
+    OI: Sw_integer;
+    HoldUndo : Boolean;
+    SCP : TPoint;
 begin
   if IsReadOnly then Exit;
   Lock;
+  HoldUndo:=GetStoreUndo;
+  SetStoreUndo(false);
+  SCP:=CurPos;
   S:=GetLineText(CurPos.Y);
   if (S<>'') and (CurPos.X<>length(S)) then
   begin
-    SetLineText(CurPos.Y,copy(S,1,LinePosToCharIdx(CurPos.Y,CurPos.X)-1));
+    OI:=LinePosToCharIdx(CurPos.Y,CurPos.X);
+    SetLineText(CurPos.Y,copy(S,1,OI-1));
     SetCurPtr(CurPos.X,CurPos.Y);
+    SetStoreUndo(HoldUndo);
+    Addaction(eaDeleteText,SCP,CurPos,copy(S,OI,High(S)),GetFlags);
+    SetStoreUndo(false);
+    AdjustSelectionPos(CurPos.X+1,CurPos.Y,-length(copy(S,OI,High(S)))+1,0);
     UpdateAttrs(CurPos.Y,attrAll);
     DrawLines(CurPos.Y);
     SetModified(true);
   end;
+  SetStoreUndo(HoldUndo);
   Unlock;
 end;