editor: Reduce allocations during editor prepaint (#61290)

Found some unnecessary allocations and an `.unwrap()` while working on a
separate issue. The PR makes no behavior changes and should be trivial
to review.

## Testing

All tests pass. These changes are not expected to change any behavior.

None of the changes are interleaving, so it should be easy to review
top-down. Reasoning for each change can be read from individual commit
messages.

Release Notes:

- N/A or Added/Fixed/Improved ...
04c247d1catidely committed on 7/20/2026, 2:52:15 AM· committed by GitHubparent1f99101
1 file changedLine totals unavailable