Maintain cursor stack's position correctly when ascending the tree

This fixes a bug that could cause the cursor to incorrectly report its
start when using `slice` or `seek_forward`, and then calling `prev`. We
didn't notice this because we were not testing those three methods
together.

I suppose this could explain some of the panics we've observed because
we do use `slice`/`seek_forward` followed by `prev` calls in production.
This commit is contained in:
Antonio Scandurra 2023-07-27 12:34:03 +02:00
parent 129e711545
commit 2e0d051a78
2 changed files with 6 additions and 3 deletions

View file

@ -438,6 +438,7 @@ where
} => {
if ascending {
entry.index += 1;
entry.position = self.position.clone();
}
for (child_tree, child_summary) in child_trees[entry.index..]