Show remote collaborators' active selections

This commit is contained in:
Antonio Scandurra 2021-12-13 11:38:38 +01:00
parent 2adf11e204
commit c984b39aaa
8 changed files with 117 additions and 45 deletions

View file

@ -49,12 +49,13 @@ pub struct Buffer {
replica_id: ReplicaId,
remote_id: u64,
local_clock: clock::Local,
lamport_clock: clock::Lamport,
pub lamport_clock: clock::Lamport,
subscriptions: Topic,
}
#[derive(Clone, Debug)]
pub struct BufferSnapshot {
replica_id: ReplicaId,
visible_text: Rope,
deleted_text: Rope,
undo_map: UndoMap,
@ -464,6 +465,7 @@ impl Buffer {
Buffer {
snapshot: BufferSnapshot {
replica_id,
visible_text,
deleted_text: Rope::new(),
fragments,
@ -495,14 +497,6 @@ impl Buffer {
self.local_clock.replica_id
}
pub fn lamport_timestamp(&self) -> clock::Lamport {
self.lamport_clock
}
pub fn observe_lamport_timestamp(&mut self, timestamp: clock::Lamport) {
self.lamport_clock.observe(timestamp);
}
pub fn remote_id(&self) -> u64 {
self.remote_id
}
@ -1219,6 +1213,10 @@ impl BufferSnapshot {
&self.visible_text
}
pub fn replica_id(&self) -> ReplicaId {
self.replica_id
}
pub fn row_count(&self) -> u32 {
self.max_point().row + 1
}