anchor.diff:  end;
   
   
  +function TKMMapEditorHistory.GetPrevAreaCheckpointPos(aPos: Integer; aArea: TKMCheckpointArea): Integer;
  +begin
  +  if aPos <= 0 then Exit(0);
  +
  +  // Find previous state of area we are undoing ("Initial" state at 0 being our last chance)
  +  Result := aPos;
  +  while Result > 0 do
  +  begin
  +    if fCheckpoints[Result].Area = aArea then
  +      Break;
  +    Dec(Result);
  +  end;
  +end;
  +
  +
  +procedure TKMMapEditorHistory.JumpTo(aIndex: Integer; aAreas: TKMCheckpointAreaSet);
  +var
  +  A: TKMCheckpointArea;
  +  prev: Integer;
  +begin
  +  for A in aAreas do
  +  begin
  +    if A = caAll then
  +      prev := 0
  +    else
  +      prev := GetPrevAreaCheckpointPos(aIndex, A);
  +
  +    fCheckpoints[prev].Apply(A, False);
  +    fCheckpointPos := aIndex;
  +    IncCounter;
  +  end;
  +end;
  +
  +
   procedure TKMMapEditorHistory.JumpTo(aIndex: Integer);
   var
     I: Integer;
     undoRedoNeeded: Boolean;
  +  areas: TKMCheckpointAreaSet;
   begin
     aIndex := EnsureRange(aIndex, 0, fCheckpoints.Count - 1);
     undoRedoNeeded := (aIndex <> fCheckpointPos);
  -  fUpdateTerrainNeeded := False;
  +
  +  if not undoRedoNeeded then Exit;
  +
  +  areas := [];
     if aIndex < fCheckpointPos then
  -  begin
  -    for I := aIndex to fCheckpointPos - 1 do
  -      Undo(False);
  -  end
  +    for I := aIndex + 1 to fCheckpointPos do //Collect areas of checkpoints that should be Undone
  +      areas := areas + [fCheckpoints[I].Area]
     else
  -  if aIndex > fCheckpointPos then
  -    for I := fCheckpointPos to aIndex - 1 do
  -      Redo(False);
  +  for I := fCheckpointPos + 1 to aIndex do // Collect areas from +1 pos upto index
  +    areas := areas + [fCheckpoints[I].Area];
  +
  +  JumpTo(aIndex, areas);
  +
  +  if (areas * [caTerrain, caAll]) <> [] then
  +      UpdateAll;
   
     if undoRedoNeeded and Assigned(fOnUndoRedo) then
       fOnUndoRedo;
  -
  -  // Update terrain once only after all undos/redos were done
  -  if fUpdateTerrainNeeded then
  -    UpdateAll;
   end;
   
   
  
positive.code:     procedure Clear;
  
      procedure MakeCheckpoint(aArea: TKMCheckpointArea; const aCaption: string);
      procedure JumpTo(aIndex: Integer);
      procedure Undo(aUpdateImmidiately: Boolean = True);
      procedure Redo(aUpdateImmidiately: Boolean = True);
    end;
  
negative.code: 
      fOnUndoRedo: TEvent;
      fOnAddCheckpoint: TEvent;
  
      function GetPrevAreaCheckpointPos(aPos: Integer; aArea: TKMCheckpointArea): Integer;
  
      procedure IncCounter;
      procedure UpdateAll;
      procedure JumpTo(aIndex: Integer; aAreas: TKMCheckpointAreaSet); overload;
    public
      constructor Create;
      destructor Destroy; override;
  