# Maintain cursor stack's position correctly when ascending the tree \(\#2795\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/46dd7178578f6c331d9303c4a3dcadc0fd5fb6d4)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 46dd7178578f6c331d9303c4a3dcadc0fd5fb6d4

Requested commit: 46dd7178578f6c331d9303c4a3dcadc0fd5fb6d4

Commit: 46dd7178578f6c331d9303c4a3dcadc0fd5fb6d4

Tree: 6735ffa275b472f743948e0c71aa92a4018250dd

Author: Antonio Scandurra

Committer: GitHub

## Message

```
Maintain cursor stack's position correctly when ascending the tree (#2795)

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.
```

## Parents

- [129e71154552f77c8ccfadd505251f57f083bb90](https://git.cafe/gitcafe/zed/commit/129e71154552f77c8ccfadd505251f57f083bb90?format=markdown)

- [2e0d051a787fa04f7e59ea14798a458533b059cf](https://git.cafe/gitcafe/zed/commit/2e0d051a787fa04f7e59ea14798a458533b059cf?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/46dd7178578f6c331d9303c4a3dcadc0fd5fb6d4?format=markdown)
