Repository navigation
fix(replay_bloc): respect a lowered limit - #4902
ChandraChaan wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
redo() adds back to _history without trimming, so redoing after lowering the limit goes past it:
cubit
..increment()..increment()..increment()
..undo()..undo()
..limit = 1
..redo()..redo()
..undo()..undo()..undo(); // 3 undos with limit 1 -> states end [..., 2, 1, 0]Calling _trimHistory() at the end of redo() fixes it.
|
Good catch @uveshm003, thanks! Reproduced it: with your sequence the states ended Fixed in b67c143: |
|
Hi maintainers, a gentle ping on this one. Lowering |
Status
READY
Breaking Changes
NO
Description
limitcan be changed after construction through the publiclimitsetter, but_ChangeStackonly enforced it partly:limitdidn't trim the existing history, soundo()could still go back past the new limit.addremoved at most one entry per change (ifinstead ofwhile), so after lowering the limit the history never shrank to it._ChangeStack.limitis now a setter that trims the history right away, andadduses the same trimming, which removes entries until the history fits. Behaviour for an unchanged limit is the same as before:nullor a negative limit keeps unlimited history, and0records nothing.Added two tests: undo after lowering the limit, and the next change after lowering the limit.
Fixes #4901
Type of Change