* fix for bug report 1869

This commit is contained in:
pierre 2002-04-16 08:27:01 +00:00
parent a18260037a
commit 364f0cf706
2 changed files with 81 additions and 65 deletions

View File

@ -114,7 +114,7 @@ type
procedure SetContent(ALines: PUnsortedStringCollection); virtual; procedure SetContent(ALines: PUnsortedStringCollection); virtual;
public public
{ Undo info storage } { Undo info storage }
procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string); virtual; procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string;AFlags : longint); virtual;
procedure AddGroupedAction(AAction : byte); virtual; procedure AddGroupedAction(AAction : byte); virtual;
procedure CloseGroupedAction(AAction : byte); virtual; procedure CloseGroupedAction(AAction : byte); virtual;
function GetUndoActionCount: sw_integer; virtual; function GetUndoActionCount: sw_integer; virtual;
@ -206,7 +206,7 @@ type
{a}function UpdateAttrsRange(FromLine, ToLine: sw_integer; Attrs: byte): sw_integer; virtual; {a}function UpdateAttrsRange(FromLine, ToLine: sw_integer; Attrs: byte): sw_integer; virtual;
public public
{ Undo info storage } { Undo info storage }
procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string); virtual; procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string;AFlags : longint); virtual;
procedure AddGroupedAction(AAction : byte); virtual; procedure AddGroupedAction(AAction : byte); virtual;
procedure CloseGroupedAction(AAction : byte); virtual; procedure CloseGroupedAction(AAction : byte); virtual;
function GetUndoActionCount: sw_integer; virtual; function GetUndoActionCount: sw_integer; virtual;
@ -655,7 +655,7 @@ begin
if StoreUndo then if StoreUndo then
begin begin
CP.X:=0;CP.Y:=I; CP.X:=0;CP.Y:=I;
AddAction(eaDeleteLine,CP,CP,GetLineText(I)); AddAction(eaDeleteLine,CP,CP,GetLineText(I),0);
end; end;
Lines^.AtFree(I); Lines^.AtFree(I);
end; end;
@ -674,7 +674,7 @@ begin
LinesInsert(-1,New(PLine, Init(@Self,S,0))); LinesInsert(-1,New(PLine, Init(@Self,S,0)));
end; end;
procedure TCodeEditorCore.AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string); procedure TCodeEditorCore.AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string;AFlags : longint);
var var
ActionIntegrated : boolean; ActionIntegrated : boolean;
pa : PEditorAction; pa : PEditorAction;
@ -712,7 +712,7 @@ begin
end; end;
if not ActionIntegrated then if not ActionIntegrated then
begin begin
UndoList^.Insert(New(PEditorAction,Init(AAction,AStartPos,AEndPos,AText))); UndoList^.Insert(New(PEditorAction,Init(AAction,AStartPos,AEndPos,AText,AFlags)));
if assigned(UndoList^.CurrentGroupedAction) then if assigned(UndoList^.CurrentGroupedAction) then
Inc(UndoList^.CurrentGroupedAction^.actionCount); Inc(UndoList^.CurrentGroupedAction^.actionCount);
UpdateUndoRedo(cmUndo,AAction); UpdateUndoRedo(cmUndo,AAction);
@ -1275,7 +1275,8 @@ end;
procedure TCodeEditor.Undo; procedure TCodeEditor.Undo;
var var
Temp,Idx,Last,Count : Longint; Temp,Idx,Last,Count : Longint;
WasInserting,Is_grouped,Had_efNoIndent : boolean; StoredFlags : longint;
WasInserting,IsGrouped,HadefNoIndent : boolean;
MaxY,MinY : sw_integer; MaxY,MinY : sw_integer;
Line : String; Line : String;
@ -1302,12 +1303,12 @@ begin
begin begin
Count:=Core^.UndoList^.At(Last)^.ActionCount; Count:=Core^.UndoList^.At(Last)^.ActionCount;
Dec(Last); Dec(Last);
Is_grouped:=true; IsGrouped:=true;
end end
else else
begin begin
Count:=1; Count:=1;
Is_grouped:=false; IsGrouped:=false;
end; end;
for Idx:=Last downto Last-Count+1 do for Idx:=Last downto Last-Count+1 do
with Core^.UndoList^.At(Idx)^ do with Core^.UndoList^.At(Idx)^ do
@ -1358,10 +1359,13 @@ begin
eaInsertLine : eaInsertLine :
begin begin
SetCurPtr(EndPos.X,EndPos.Y); SetCurPtr(EndPos.X,EndPos.Y);
SetDisplayText(EndPos.Y,Copy(GetDisplayText(EndPos.Y),EndPos.X+1,255)); Line:=Copy(GetDisplayText(StartPos.Y),1,StartPos.X);
If Length(Line)<StartPos.X then
Line:=Line+CharStr(' ',StartPos.X-length(Line))+GetStr(Text);
SetDisplayText(StartPos.Y,Line+Copy(GetDisplayText(EndPos.Y),EndPos.X+1,255));
SetMinMax(EndPos.Y); SetMinMax(EndPos.Y);
SetCurPtr(0,EndPos.Y); SetCurPtr(0,EndPos.Y);
BackSpace; DeleteLine(EndPos.Y);
SetCurPtr(StartPos.X,StartPos.Y); SetCurPtr(StartPos.X,StartPos.Y);
SetMinMax(StartPos.Y); SetMinMax(StartPos.Y);
end; end;
@ -1369,13 +1373,13 @@ begin
begin begin
SetCurPtr(EndPos.X,EndPos.Y); SetCurPtr(EndPos.X,EndPos.Y);
SetMinMax(EndPos.Y); SetMinMax(EndPos.Y);
Had_efNoIndent:=(GetFlags and efNoIndent)<>0; HadefNoIndent:=(GetFlags and efNoIndent)<>0;
WasInserting:=GetInsertMode; WasInserting:=GetInsertMode;
SetInsertMode(true); SetInsertMode(true);
SetFlags(GetFlags or efNoIndent); SetFlags(GetFlags or efNoIndent);
InsertNewLine; InsertNewLine;
SetInsertMode(WasInserting); SetInsertMode(WasInserting);
if not Had_efNoIndent then if not HadefNoIndent then
SetFlags(GetFlags and not efNoIndent); SetFlags(GetFlags and not efNoIndent);
{DelEnd; wrong for eaCut at least } {DelEnd; wrong for eaCut at least }
SetCurPtr(StartPos.X,StartPos.Y); SetCurPtr(StartPos.X,StartPos.Y);
@ -1399,7 +1403,7 @@ begin
else else
UpdateUndoRedo(cmUndo,0); UpdateUndoRedo(cmUndo,0);
end;{Idx loop for grouped actions } end;{Idx loop for grouped actions }
if is_grouped then if IsGrouped then
begin begin
Idx:=Core^.UndoList^.Count-1; Idx:=Core^.UndoList^.Count-1;
Core^.RedoList^.Insert(Core^.UndoList^.At(Idx)); Core^.RedoList^.Insert(Core^.UndoList^.At(Idx));
@ -1424,8 +1428,9 @@ end;
procedure TCodeEditor.Redo; procedure TCodeEditor.Redo;
var var
Temp,Idx,Last,Count : Longint; Temp,Idx,i,Last,Count : Longint;
WasInserting,Is_grouped,Had_efNoIndent : boolean; StoredFlags : longint;
WasInserting,IsGrouped,ShouldInsertText : boolean;
Line : String; Line : String;
MaxY,MinY : sw_integer; MaxY,MinY : sw_integer;
procedure SetMinMax(y : sw_integer); procedure SetMinMax(y : sw_integer);
@ -1451,12 +1456,12 @@ begin
begin begin
Count:=Core^.RedoList^.At(Last)^.ActionCount; Count:=Core^.RedoList^.At(Last)^.ActionCount;
Dec(Last); Dec(Last);
Is_grouped:=true; IsGrouped:=true;
end end
else else
begin begin
Count:=1; Count:=1;
Is_grouped:=false; IsGrouped:=false;
end; end;
for Idx:=Last downto Last-Count+1 do for Idx:=Last downto Last-Count+1 do
with Core^.RedoList^.At(Idx)^ do with Core^.RedoList^.At(Idx)^ do
@ -1502,16 +1507,18 @@ begin
eaInsertLine : eaInsertLine :
begin begin
SetCurPtr(StartPos.X,StartPos.Y); SetCurPtr(StartPos.X,StartPos.Y);
Had_efNoIndent:=(GetFlags and efNoIndent)<>0; StoredFlags:=GetFlags;
SetFlags(GetFlags or efNoIndent); SetFlags(Flags);
WasInserting:=GetInsertMode;
SetInsertMode(false);
InsertNewLine; InsertNewLine;
SetInsertMode(WasInserting); SetCurPtr(0,EndPos.Y);
SetCurPtr(StartPos.X,StartPos.Y); Line:=GetStr(Text);
InsertText(GetStr(Text)); ShouldInsertText:=false;
if not Had_efNoIndent then for I:=1 to Length(Line) do
SetFlags(GetFlags and not efNoIndent); if Line[I]<>' ' then
ShouldInsertText:=true;
If ShouldInsertText then
InsertText(Line);
SetFlags(StoredFlags);
SetCurPtr(EndPos.X,EndPos.Y); SetCurPtr(EndPos.X,EndPos.Y);
SetMinMax(StartPos.Y); SetMinMax(StartPos.Y);
end; end;
@ -1545,7 +1552,7 @@ begin
UpdateUndoRedo(cmRedo,0); UpdateUndoRedo(cmRedo,0);
Core^.RedoList^.atDelete(Idx); Core^.RedoList^.atDelete(Idx);
end;{ Idx loop for grouped action } end;{ Idx loop for grouped action }
If is_grouped then If IsGrouped then
begin begin
Idx:=Core^.RedoList^.count-1; Idx:=Core^.RedoList^.count-1;
Core^.UndoList^.Insert(Core^.RedoList^.At(Idx)); Core^.UndoList^.Insert(Core^.RedoList^.At(Idx));
@ -1688,9 +1695,9 @@ begin
UpdateAttrsRange:=Core^.UpdateAttrsRange(FromLine,ToLine,Attrs); UpdateAttrsRange:=Core^.UpdateAttrsRange(FromLine,ToLine,Attrs);
end; end;
procedure TCodeEditor.AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string); procedure TCodeEditor.AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string;AFlags : longint);
begin begin
Core^.AddAction(AAction,AStartPos,AEndPos,AText); Core^.AddAction(AAction,AStartPos,AEndPos,AText,AFlags);
end; end;
procedure TCodeEditor.AddGroupedAction(AAction : byte); procedure TCodeEditor.AddGroupedAction(AAction : byte);
@ -2037,7 +2044,10 @@ end;
END. END.
{ {
$Log$ $Log$
Revision 1.7 2002-01-25 14:15:35 pierre Revision 1.8 2002-04-16 08:27:01 pierre
* fix for bug report 1869
Revision 1.7 2002/01/25 14:15:35 pierre
* fix bug 1774 * fix bug 1774
Revision 1.6 2001/10/10 23:34:54 pierre Revision 1.6 2001/10/10 23:34:54 pierre

View File

@ -300,6 +300,7 @@ type
EndPos : TPoint; EndPos : TPoint;
Text : PString; Text : PString;
ActionCount : longint; ActionCount : longint;
Flags : longint;
Action : byte; Action : byte;
IsGrouped : boolean; IsGrouped : boolean;
TimeStamp : longint; { this is needed to keep track of line number & TimeStamp : longint; { this is needed to keep track of line number &
@ -311,7 +312,7 @@ type
the (probably) changed line & position information, the (probably) changed line & position information,
so, we can still jump to the right position in the so, we can still jump to the right position in the
editor even when it is heavily modified - Gabor } editor even when it is heavily modified - Gabor }
constructor init(act:byte; StartP,EndP:TPoint;Txt:String); constructor init(act:byte; StartP,EndP:TPoint;Txt:String;AFlags : longint);
constructor init_group(act:byte); constructor init_group(act:byte);
function is_grouped_action : boolean; function is_grouped_action : boolean;
destructor done; virtual; destructor done; virtual;
@ -444,7 +445,7 @@ type
Attrs: byte): sw_integer; virtual; Attrs: byte): sw_integer; virtual;
public public
{ Undo info storage } { Undo info storage }
{a}procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string); virtual; {a}procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string;AFlags : longint); virtual;
{a}procedure AddGroupedAction(AAction : byte); virtual; {a}procedure AddGroupedAction(AAction : byte); virtual;
{a}procedure CloseGroupedAction(AAction : byte); virtual; {a}procedure CloseGroupedAction(AAction : byte); virtual;
{a}function GetUndoActionCount: sw_integer; virtual; {a}function GetUndoActionCount: sw_integer; virtual;
@ -600,7 +601,7 @@ type
{a}function UpdateAttrsRange(FromLine, ToLine: sw_integer; Attrs: byte): sw_integer; virtual; {a}function UpdateAttrsRange(FromLine, ToLine: sw_integer; Attrs: byte): sw_integer; virtual;
public public
{ Undo info storage } { Undo info storage }
{a}procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string); virtual; {a}procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string;AFlags : longint); virtual;
{a}procedure AddGroupedAction(AAction : byte); virtual; {a}procedure AddGroupedAction(AAction : byte); virtual;
{a}procedure CloseGroupedAction(AAction : byte); virtual; {a}procedure CloseGroupedAction(AAction : byte); virtual;
{a}function GetUndoActionCount: sw_integer; virtual; {a}function GetUndoActionCount: sw_integer; virtual;
@ -2479,7 +2480,7 @@ begin
Unlock(Editor); Unlock(Editor);
end; end;
procedure TCustomCodeEditorCore.AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string); procedure TCustomCodeEditorCore.AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string;AFlags : longint);
begin begin
Abstract; Abstract;
end; end;
@ -2901,7 +2902,7 @@ begin
begin begin
InsertLine(DestPos.Y,''); InsertLine(DestPos.Y,'');
EPOS.X:=0;EPos.Y:=DestPos.Y; EPOS.X:=0;EPos.Y:=DestPos.Y;
AddAction(eaInsertLine,BPos,EPos,''); AddAction(eaInsertLine,BPos,EPos,'',GetFlags);
LimitsChanged; LimitsChanged;
end; end;
@ -2947,14 +2948,14 @@ begin
SetLineText(DestPos.Y,DS+AfterS); SetLineText(DestPos.Y,DS+AfterS);
BPos.X:=DestPos.X;BPos.Y:=DestPos.Y; BPos.X:=DestPos.X;BPos.Y:=DestPos.Y;
EPOS.X:=DestPos.X+RX-RSX;EPos.Y:=DestPos.Y; EPOS.X:=DestPos.X+RX-RSX;EPos.Y:=DestPos.Y;
AddAction(eaInsertText,BPos,EPos,S); AddAction(eaInsertText,BPos,EPos,S,GetFlags);
end end
else else
begin begin
SetLineText(DestPos.Y,DS); SetLineText(DestPos.Y,DS);
BPos.X:=DestPos.X;BPos.Y:=DestPos.Y; BPos.X:=DestPos.X;BPos.Y:=DestPos.Y;
EPOS.X:=DestPos.X+RX-RSX;EPos.Y:=DestPos.Y; EPOS.X:=DestPos.X+RX-RSX;EPos.Y:=DestPos.Y;
AddAction(eaInsertText,BPos,EPos,S); AddAction(eaInsertText,BPos,EPos,S,GetFlags);
end; end;
BPos.X:=EPos.X; BPos.X:=EPos.X;
if LineDelta=LineCount-1 then if LineDelta=LineCount-1 then
@ -3009,7 +3010,7 @@ begin
AddChar(S[I]); AddChar(S[I]);
InsertText:=true; InsertText:=true;
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
AddAction(eaInsertText,OldPos,CurPos,S); AddAction(eaInsertText,OldPos,CurPos,S,GetFlags);
UnLock; UnLock;
end; end;
@ -3966,7 +3967,7 @@ begin
UpdateAttrsRange:=-1; UpdateAttrsRange:=-1;
end; end;
procedure TCustomCodeEditor.AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string); procedure TCustomCodeEditor.AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string;AFlags : longint);
begin begin
{ Abstract } { Abstract }
end; end;
@ -4458,7 +4459,7 @@ begin
{ the only drawback is that we keep { the only drawback is that we keep
the original text even if Toggle where the original text even if Toggle where
it is not really necessary PM } it is not really necessary PM }
Addaction(eaOverwriteText,StartPos,StartPos,Copy(S,X1+1,X2-X1+1)); Addaction(eaOverwriteText,StartPos,StartPos,Copy(S,X1+1,X2-X1+1),GetFlags);
SetStoreUndo(false); SetStoreUndo(false);
for X:=X1 to X2 do for X:=X1 to X2 do
begin begin
@ -4478,7 +4479,7 @@ begin
UpdateAttrsRange(StartP.Y,EndP.Y,attrAll); UpdateAttrsRange(StartP.Y,EndP.Y,attrAll);
DrawLines(CurPos.Y); DrawLines(CurPos.Y);
SetModified(true); SetModified(true);
Addaction(eaMoveCursor,StartPos,CurPos,''); Addaction(eaMoveCursor,StartPos,CurPos,'',GetFlags);
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
UnLock; UnLock;
end; end;
@ -4750,10 +4751,8 @@ begin
EI^.Fold^.Collapse(false); EI^.Fold^.Collapse(false);
end; end;
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
if not overwrite then { obsolete IndentStr is taken care of by the Flags PM }
Addaction(eaInsertLine,SCP,CurPos,IndentStr) Addaction(eaInsertLine,SCP,CurPos,CharStr(' ',i-1){IndentStr},GetFlags);
else
AddAction(eaMoveCursor,SCP,CurPos,'');
SetStoreUndo(false); SetStoreUndo(false);
AdjustSelection(CurPos.X-SCP.X,CurPos.Y-SCP.Y); AdjustSelection(CurPos.X-SCP.X,CurPos.Y-SCP.Y);
end else end else
@ -4767,7 +4766,8 @@ begin
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
UpdateAttrs(CurPos.Y,attrAll); UpdateAttrs(CurPos.Y,attrAll);
SetCurPtr(Ind,CurPos.Y+1); SetCurPtr(Ind,CurPos.Y+1);
Addaction(eaInsertLine,SCP,CurPos,IndentStr); { obsolete IndentStr is taken care of by the Flags PM }
Addaction(eaInsertLine,SCP,CurPos,''{IndentStr},GetFlags);
SetStoreUndo(false); SetStoreUndo(false);
end end
else else
@ -4775,6 +4775,7 @@ begin
UpdateAttrs(CurPos.Y,attrAll); UpdateAttrs(CurPos.Y,attrAll);
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
SetCurPtr(Ind,CurPos.Y+1); SetCurPtr(Ind,CurPos.Y+1);
AddAction(eaMoveCursor,SCP,CurPos,'',GetFlags);
SetStoreUndo(false); SetStoreUndo(false);
end; end;
end; end;
@ -4808,7 +4809,7 @@ begin
SetLineText(CurPos.Y-1,S+GetLineText(CurPos.Y)); SetLineText(CurPos.Y-1,S+GetLineText(CurPos.Y));
SC1.X:=Length(S);SC1.Y:=CurPOS.Y-1; SC1.X:=Length(S);SC1.Y:=CurPOS.Y-1;
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
AddAction(eaDeleteLine,SCP,SC1,GetLineText(CurPos.Y)); AddAction(eaDeleteLine,SCP,SC1,GetLineText(CurPos.Y),GetFlags);
SetStoreUndo(false); SetStoreUndo(false);
DeleteLine(CurPos.Y); DeleteLine(CurPos.Y);
LimitsChanged; LimitsChanged;
@ -4847,7 +4848,7 @@ begin
SetLineText(CurPos.Y,copy(S,1,CI-1)+copy(S,OI,High(S))); SetLineText(CurPos.Y,copy(S,1,CI-1)+copy(S,OI,High(S)));
SetCurPtr(CP,CurPos.Y); SetCurPtr(CP,CurPos.Y);
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
Addaction(eaDeleteText,SCP,CurPos,Copy(S,CI,OI-CI)); Addaction(eaDeleteText,SCP,CurPos,Copy(S,CI,OI-CI),GetFlags);
SetStoreUndo(false); SetStoreUndo(false);
end; end;
UpdateAttrs(CurPos.Y,attrAll); UpdateAttrs(CurPos.Y,attrAll);
@ -4877,8 +4878,8 @@ begin
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
SCP.X:=0;SCP.Y:=CurPos.Y+1; SCP.X:=0;SCP.Y:=CurPos.Y+1;
AddGroupedAction(eaDelChar); AddGroupedAction(eaDelChar);
AddAction(eaMoveCursor,CurPos,SCP,''); AddAction(eaMoveCursor,CurPos,SCP,'',GetFlags);
AddAction(eaDeleteLine,SCP,CurPos,GetLineText(CurPos.Y+1)); AddAction(eaDeleteLine,SCP,CurPos,GetLineText(CurPos.Y+1),GetFlags);
CloseGroupedAction(eaDelChar); CloseGroupedAction(eaDelChar);
SetStoreUndo(false); SetStoreUndo(false);
DeleteLine(CurPos.Y+1); DeleteLine(CurPos.Y+1);
@ -4901,13 +4902,13 @@ begin
else else
S:=Copy(S,1,CI-1)+CharStr(' ',GetTabSize-1)+Copy(S,CI+1,High(S)); S:=Copy(S,1,CI-1)+CharStr(' ',GetTabSize-1)+Copy(S,CI+1,High(S));
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
Addaction(eaDeleteText,CurPos,CurPos,#9); Addaction(eaDeleteText,CurPos,CurPos,#9,GetFlags);
SetStoreUndo(false); SetStoreUndo(false);
end end
else else
begin begin
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
Addaction(eaDeleteText,CurPos,CurPos,S[CI]); Addaction(eaDeleteText,CurPos,CurPos,S[CI],GetFlags);
SetStoreUndo(false); SetStoreUndo(false);
Delete(S,CI,1); Delete(S,CI,1);
end; end;
@ -5039,7 +5040,7 @@ begin
UpdateAttrs(Max(0,CurPos.Y-1),attrAll); UpdateAttrs(Max(0,CurPos.Y-1),attrAll);
DrawLines(CurPos.Y); DrawLines(CurPos.Y);
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
AddAction(eaDeleteLine,SP,CurPos,S); AddAction(eaDeleteLine,SP,CurPos,S,GetFlags);
SetModified(true); SetModified(true);
end; end;
Unlock; Unlock;
@ -5143,7 +5144,7 @@ begin
begin begin
SPos.X:=StartX; SPos.X:=StartX;
SPos.Y:=CurLine; SPos.Y:=CurLine;
AddAction(eaDeleteText,SPos,SPos,Copy(S,StartX+1,EndX-StartX)); AddAction(eaDeleteText,SPos,SPos,Copy(S,StartX+1,EndX-StartX),GetFlags);
end; end;
Inc(CurLine); Inc(CurLine);
LastX:=SelStart.X; LastX:=SelStart.X;
@ -5160,7 +5161,7 @@ begin
begin begin
SPos.X:=StartX; SPos.X:=StartX;
SPos.Y:=CurLine; SPos.Y:=CurLine;
AddAction(eaDeleteText,SPos,SPos,Copy(S,StartX+1,High(S))); AddAction(eaDeleteText,SPos,SPos,Copy(S,StartX+1,High(S)),GetFlags);
S:=GetDisplayText(CurLine+LineCount-1); S:=GetDisplayText(CurLine+LineCount-1);
end; end;
Inc(CurLine); Inc(CurLine);
@ -5174,7 +5175,7 @@ begin
end; end;
if GetStoreUndo then if GetStoreUndo then
begin begin
AddAction(eaInsertText,SPos,SPos,Copy(S,EndX+1,High(S))); AddAction(eaInsertText,SPos,SPos,Copy(S,EndX+1,High(S)),GetFlags);
end; end;
end; end;
HideSelect; HideSelect;
@ -5290,11 +5291,11 @@ begin
S:=GetLineText(i); S:=GetLineText(i);
SetLineText(i,Ind+S); SetLineText(i,Ind+S);
Pos.X:=0;Pos.Y:=i; Pos.X:=0;Pos.Y:=i;
AddAction(eaInsertText,Pos,Pos,Ind); AddAction(eaInsertText,Pos,Pos,Ind,GetFlags);
end; end;
SetCurPtr(CurPos.X,CurPos.Y); SetCurPtr(CurPos.X,CurPos.Y);
{ must be added manually here PM } { must be added manually here PM }
AddAction(eaMoveCursor,Pos,CurPos,''); AddAction(eaMoveCursor,Pos,CurPos,'',GetFlags);
UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll); UpdateAttrsRange(SelStart.Y,SelEnd.Y,attrAll);
DrawLines(CurPos.Y); DrawLines(CurPos.Y);
SetModified(true); SetModified(true);
@ -5365,7 +5366,7 @@ begin
begin begin
Pos.Y:=i; Pos.Y:=i;
Pos.X:=0; Pos.X:=0;
AddAction(eaDeleteText,Pos,Pos,CharStr(' ',k)); AddAction(eaDeleteText,Pos,Pos,CharStr(' ',k),GetFlags);
end; end;
end; end;
SetCurPtr(CurPos.X,CurPos.Y); SetCurPtr(CurPos.X,CurPos.Y);
@ -5630,9 +5631,9 @@ begin
{ must be before CloseBrackets !! } { must be before CloseBrackets !! }
SetStoreUndo(HoldUndo); SetStoreUndo(HoldUndo);
if Overwrite then if Overwrite then
Addaction(eaOverwriteText,SP,CurPos,Copy(S,CI,length(SC))) Addaction(eaOverwriteText,SP,CurPos,Copy(S,CI,length(SC)),GetFlags)
else else
Addaction(eaInsertText,SP,CurPos,SC); Addaction(eaInsertText,SP,CurPos,SC,GetFlags);
SetStoreUndo(false); SetStoreUndo(false);
if IsFlagSet(efAutoBrackets) then if IsFlagSet(efAutoBrackets) then
begin begin
@ -5705,7 +5706,7 @@ begin
InsertLine(i,s); InsertLine(i,s);
BPos.X:=0;BPos.Y:=i; BPos.X:=0;BPos.Y:=i;
EPOS.X:=Length(s);EPos.Y:=i; EPOS.X:=Length(s);EPos.Y:=i;
AddAction(eaInsertLine,BPos,EPos,GetDisplayText(i)); AddAction(eaInsertLine,BPos,EPos,GetDisplayText(i),GetFlags);
end; end;
if p13+1=p10 then if p13+1=p10 then
p13[0]:=#13 p13[0]:=#13
@ -6388,7 +6389,7 @@ begin
{ if ((CurPos.X<>OldPos.X) or (CurPos.Y<>OldPos.Y)) and (HighlightRow<>-1) then { if ((CurPos.X<>OldPos.X) or (CurPos.Y<>OldPos.Y)) and (HighlightRow<>-1) then
SetHighlightRow(-1);} SetHighlightRow(-1);}
if ((CurPos.X<>OldPos.X) or (CurPos.Y<>OldPos.Y)) then if ((CurPos.X<>OldPos.X) or (CurPos.Y<>OldPos.Y)) then
AddAction(eaMoveCursor,OldPos,CurPos,''); AddAction(eaMoveCursor,OldPos,CurPos,'',GetFlags);
if ((CurPos.X<>OldPos.X) or (CurPos.Y<>OldPos.Y)) then if ((CurPos.X<>OldPos.X) or (CurPos.Y<>OldPos.Y)) then
PositionChanged;{UpdateIndicator;} PositionChanged;{UpdateIndicator;}
UnLock; UnLock;
@ -6680,13 +6681,14 @@ begin
end; end;
constructor TEditorAction.init(act:byte; StartP,EndP:TPoint;Txt:String); constructor TEditorAction.init(act:byte; StartP,EndP:TPoint;Txt:String;AFlags : longint);
begin begin
Action:=act; Action:=act;
StartPos:=StartP; StartPos:=StartP;
EndPos:=EndP; EndPos:=EndP;
Text:=NewStr(txt); Text:=NewStr(txt);
ActionCount:=0; ActionCount:=0;
Flags:=AFlags;
IsGrouped:=false; IsGrouped:=false;
end; end;
@ -6694,6 +6696,7 @@ constructor TEditorAction.init_group(act:byte);
begin begin
Action:=act; Action:=act;
ActionCount:=0; ActionCount:=0;
Flags:=0;
IsGrouped:=true; IsGrouped:=true;
end; end;
@ -7096,7 +7099,10 @@ end;
END. END.
{ {
$Log$ $Log$
Revision 1.17 2002-01-25 14:15:35 pierre Revision 1.18 2002-04-16 08:27:01 pierre
* fix for bug report 1869
Revision 1.17 2002/01/25 14:15:35 pierre
* fix bug 1774 * fix bug 1774
Revision 1.16 2001/11/07 00:18:00 pierre Revision 1.16 2001/11/07 00:18:00 pierre