Introduce multi-cursor inline transformations (#13368)

https://github.com/zed-industries/zed/assets/482957/591def34-e5c8-4402-9c6b-372cbca720c3

Release Notes:

- N/A

---------

Co-authored-by: Richard Feldman <oss@rtfeldman.com>
This commit is contained in:
Antonio Scandurra 2024-06-21 17:41:43 +02:00 committed by GitHub
parent c58a8f1a04
commit cb0b8b4c4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 1335 additions and 698 deletions

View file

@ -1701,6 +1701,8 @@ impl Buffer {
},
cx,
);
self.selections_update_count += 1;
cx.notify();
}
/// Clears the selections, so that other replicas of the buffer do not see any selections for
@ -3355,9 +3357,10 @@ impl BufferSnapshot {
/// Returns selections for remote peers intersecting the given range.
#[allow(clippy::type_complexity)]
pub fn remote_selections_in_range(
pub fn selections_in_range(
&self,
range: Range<Anchor>,
include_local: bool,
) -> impl Iterator<
Item = (
ReplicaId,
@ -3368,8 +3371,9 @@ impl BufferSnapshot {
> + '_ {
self.remote_selections
.iter()
.filter(|(replica_id, set)| {
**replica_id != self.text.replica_id() && !set.selections.is_empty()
.filter(move |(replica_id, set)| {
(include_local || **replica_id != self.text.replica_id())
&& !set.selections.is_empty()
})
.map(move |(replica_id, set)| {
let start_ix = match set.selections.binary_search_by(|probe| {