Skip to content

Fix panic involving growing and shrinking selections while buffer size changes#48898

Merged
eholk merged 2 commits intozed-industries:mainfrom
eholk:crash-repro
Feb 19, 2026
Merged

Fix panic involving growing and shrinking selections while buffer size changes#48898
eholk merged 2 commits intozed-industries:mainfrom
eholk:crash-repro

Conversation

@eholk
Copy link
Contributor

@eholk eholk commented Feb 11, 2026

Repro steps:

  1. Make a Rust file and check it in to git
  2. Delete a lot of the file
  3. Expand all the diffs (cmd+")
  4. Select larger syntax node (ctrl+cmd+right)
  5. Collapse all the diffs
  6. Select smaller syntax node (ctrl+cmd+left)
  7. Panic!

The problem was we were using byte offsets instead of anchors so after we shrank the buffer by collapsing diffs we'd be pointing past the end of it.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 11, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Feb 11, 2026
@zed-industries-bot
Copy link
Contributor

zed-industries-bot commented Feb 11, 2026

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against c88b864

@mikayla-maki mikayla-maki self-assigned this Feb 11, 2026
@eholk eholk force-pushed the crash-repro branch 2 times, most recently from 4c87092 to 80e02e4 Compare February 19, 2026 18:37
@eholk eholk enabled auto-merge (squash) February 19, 2026 18:45
@eholk eholk merged commit 1e847c1 into zed-industries:main Feb 19, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants