editor: Fix rewrapping with an empty selection (#51742)

Closes #43043

Rewrapping logic for when there was nothing selected was desynced from
the code that handles selections.
The desired wrapping can be achieved when you selected the markdown
paragraph and use the rewrap action.

This PR moves the logic that selects lines for the case where there is
no selection further up to reuse the existing rewrapping logic

<img width="862" height="553" alt="image"
src="https://github.com/user-attachments/assets/87f7c6cb-7855-4193-b17a-f938f8c9a210"
/>

- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed rewrapping paragraphs in markdown when you have nothing selected

---------

Co-authored-by: Tom Houlé <tom@tomhoule.com>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2051578819Kurian Jojo committed on 3/19/2026, 7:42:30 PM· committed by GitHubparentff2e5d4
2 files changedLine totals unavailable