fixed the dreadful "Undo list index out of range" bug

This commit is contained in:
zueuk 2005-10-25 10:57:41 +00:00
parent f95eef2378
commit bbfdaac633

View File

@ -912,7 +912,7 @@ procedure TMainForm.UpdateUndo;
begin begin
SaveFlame(MainCp, Format('%.4d-', [UndoIndex]) + MainCp.name, AppPath + 'apophysis.undo'); SaveFlame(MainCp, Format('%.4d-', [UndoIndex]) + MainCp.name, AppPath + 'apophysis.undo');
Inc(UndoIndex); Inc(UndoIndex);
inc(UndoMax); UndoMax := UndoIndex; //Inc(UndoMax);
mnuSaveUndo.Enabled := true; mnuSaveUndo.Enabled := true;
mnuUndo.Enabled := True; mnuUndo.Enabled := True;
mnuPopUndo.Enabled := True; mnuPopUndo.Enabled := True;
@ -1294,8 +1294,8 @@ begin
if EntryExists(title, filename) then DeleteEntry(title, fileName); if EntryExists(title, filename) then DeleteEntry(title, fileName);
Append(IFile); Append(IFile);
end end
else else ReWrite(IFile);
ReWrite(IFile);
sl := TStringList.Create; sl := TStringList.Create;
try try
cp1.SaveToStringList(sl); cp1.SaveToStringList(sl);
@ -3250,7 +3250,7 @@ begin
StopThread; StopThread;
Inc(UndoIndex); Inc(UndoIndex);
assert(UndoIndex < UndoMax, 'Undo list index out of range!'); assert(UndoIndex <= UndoMax, 'Undo list index out of range!');
LoadUndoFlame(UndoIndex, AppPath + 'apophysis.undo'); LoadUndoFlame(UndoIndex, AppPath + 'apophysis.undo');
mnuUndo.Enabled := True; mnuUndo.Enabled := True;