Now, if you [ESC] to get to where you already were, it will just go
back to the existing stack entry.
(But maybe this still isn't strong enough? Perhaps we need to search
for it all the way up?)
def chain_to(self, activity):
assert self.cc.activity_stack[-1] is self
- self.cc.activity_stack[-1] = activity
+ if (len(self.cc.activity_stack) > 1 and
+ self.cc.activity_stack[-2] == activity):
+ self.cc.activity_stack.pop()
+ else:
+ self.cc.activity_stack[-1] = activity
def push_to(self, activity):
self.cc.activity_stack.append(activity)