Files
zed/crates/editor
Parker Loflin 52b0e43064 editor: Don't write empty selections to the primary selection (#66986)
Closes #64446

## Summary

On Linux, each local selection change copies the selected text to the
primary selection and joins multiple selections with newlines. It
skipped the write only when the joined text was empty. With two or more
cursors and nothing selected, the text is one newline per extra cursor,
so every cursor move or keystroke replaced the primary selection with
newlines.

It now skips the write when every selection is empty.

## Testing

`cargo test -p editor --lib` passes on Linux.
`test_empty_selections_keep_primary_selection` is new, compiled only on
Linux and FreeBSD, and fails without the fix.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed multiple cursors overwriting the primary selection with newlines
on Linux
2026-11-16 13:59:16 +00:00
..