editor: Fix crash when pasting after copy and trim in visual line mode (#46640)
Dino
created
When using the `editor::actions::CopyAndTrim` action with a multi-line
selection in vim's Visual Line mode, pasting would crash Zed.
The bug occurred because trimming splits a selection into per-line
ranges, creating multiple `editor::ClipboardSelection` entries. However,
when `is_entire_line` was true (Visual Line mode), no newline separators
were added between these entries in the clipboard text. The paste code
then assumed separators existed and read past the end of the text.
The fix ensures newline separators are always added between trimmed line
ranges, regardless of whether the original selection was in line mode.
Closes #46616
Release Notes:
- Fixed a crash when pasting after using `editor: copy and trim` in
vim's Visual Line mode