# helix: Fix line selection after undoing delete \(\#55365\) · gitcafe/zed

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

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

Visibility: public

Requested revision: befa775029df56bb277927f49168cdde771c818b

Requested commit: befa775029df56bb277927f49168cdde771c818b

Commit: befa775029df56bb277927f49168cdde771c818b

Tree: 1e02dfde3f71556ef4b6ce1506f90d9efe389b6c

Author: Mikhail Pertsev

Committer: GitHub

## Message

```
helix: Fix line selection after undoing delete (#55365)

Closes #55170

Fixes Helix mode undo selection history after `d` deletes the character
under an empty cursor. Previously, `d` temporarily expanded the cursor
to a one-character selection before deleting, and undo restored that
temporary selection. When the deleted character was a newline, pressing
`x` after undo selected additional line which was wrong.

This preserves the original Helix selection as the undo-restored
selection while keeping the existing delete behavior unchanged.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed Helix mode selecting one extra line after undoing a newline
delete

Co-authored-by: Tom Houlé <13155277+tomhoule@users.noreply.github.com>
```

## Parents

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

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