Skip to content

Commit

Permalink
undo: refac
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed Jun 5, 2020
1 parent e7914c5 commit e8bddfc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions atsynedit/atstrings.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@ procedure TATStrings.DoUndoSingle(ACurList: TATUndoList;
ALineState: TATLineState;
ACarets: TATPointArray;
NCount: integer;
OtherList: TATUndoList;
begin
ASoftMarked:= true;
AHardMarked:= false;
Expand All @@ -1642,6 +1643,11 @@ procedure TATStrings.DoUndoSingle(ACurList: TATUndoList;
AHardMarkedNext:= (NCount>1) and (ACurList[NCount-2].ItemHardMark);
AUnmodifiedNext:= (NCount>1) and (ACurList[NCount-2].ItemAction=aeaClearModified);

if ACurList=FUndoList then
OtherList:= FRedoList
else
OtherList:= FUndoList;

//don't undo if one item left: unmodified-mark
if ACurList.IsEmpty then exit;

Expand Down Expand Up @@ -1680,11 +1686,7 @@ procedure TATStrings.DoUndoSingle(ACurList: TATUndoList;

aeaClearModified:
begin
//add unmodified mark to undo/redo
if ACurList=FUndoList then
FRedoList.AddUnmodifiedMark
else
FUndoList.AddUnmodifiedMark;
OtherList.AddUnmodifiedMark;
exit;
end

Expand Down

0 comments on commit e8bddfc

Please sign in to comment.