Closes [#58343](<https://github.com/zed-industries/zed/issues/58343>) This crash happened because Helix paste restored selection using the raw clipboard text length, but buffer edits normalize CRLF line endings to LF before inserting. When pasting CRLF text at or near EOF, the restored selection could extend past the normalized snapshot length and panic in `MutableSelectionsCollection::select_ranges`. The fix normalizes the text before measuring it for selection restoration and adds regression coverage for CRLF paste in Helix mode. 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 a crash that could occur when pasting at the end of a file in Helix mode
4 files changedLine totals unavailable