Rename editor::Event::Edited to editor::Event::BufferEdited

This is to distinguish it from a new event we're about to add which
represent edits originating from that specific editor.
This commit is contained in:
Antonio Scandurra 2022-03-24 08:55:46 +01:00
parent 864bede8a2
commit a739c362d9
11 changed files with 26 additions and 38 deletions

View file

@ -142,7 +142,7 @@ pub enum Operation {
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Event {
Operation(Operation),
Edited { local: bool },
Edited,
Dirtied,
Saved,
FileHandleChanged,
@ -967,7 +967,7 @@ impl Buffer {
) -> Option<TransactionId> {
if let Some((transaction_id, start_version)) = self.text.end_transaction_at(now) {
let was_dirty = start_version != self.saved_version;
self.did_edit(&start_version, was_dirty, true, cx);
self.did_edit(&start_version, was_dirty, cx);
Some(transaction_id)
} else {
None
@ -1160,7 +1160,6 @@ impl Buffer {
&mut self,
old_version: &clock::Global,
was_dirty: bool,
local: bool,
cx: &mut ModelContext<Self>,
) {
if self.edits_since::<usize>(old_version).next().is_none() {
@ -1169,7 +1168,7 @@ impl Buffer {
self.reparse(cx);
cx.emit(Event::Edited { local });
cx.emit(Event::Edited);
if !was_dirty {
cx.emit(Event::Dirtied);
}
@ -1206,7 +1205,7 @@ impl Buffer {
self.text.apply_ops(buffer_ops)?;
self.deferred_ops.insert(deferred_ops);
self.flush_deferred_ops(cx);
self.did_edit(&old_version, was_dirty, false, cx);
self.did_edit(&old_version, was_dirty, cx);
// Notify independently of whether the buffer was edited as the operations could include a
// selection update.
cx.notify();
@ -1321,7 +1320,7 @@ impl Buffer {
if let Some((transaction_id, operation)) = self.text.undo() {
self.send_operation(Operation::Buffer(operation), cx);
self.did_edit(&old_version, was_dirty, true, cx);
self.did_edit(&old_version, was_dirty, cx);
Some(transaction_id)
} else {
None
@ -1342,7 +1341,7 @@ impl Buffer {
self.send_operation(Operation::Buffer(operation), cx);
}
if undone {
self.did_edit(&old_version, was_dirty, true, cx)
self.did_edit(&old_version, was_dirty, cx)
}
undone
}
@ -1353,7 +1352,7 @@ impl Buffer {
if let Some((transaction_id, operation)) = self.text.redo() {
self.send_operation(Operation::Buffer(operation), cx);
self.did_edit(&old_version, was_dirty, true, cx);
self.did_edit(&old_version, was_dirty, cx);
Some(transaction_id)
} else {
None
@ -1374,7 +1373,7 @@ impl Buffer {
self.send_operation(Operation::Buffer(operation), cx);
}
if redone {
self.did_edit(&old_version, was_dirty, true, cx)
self.did_edit(&old_version, was_dirty, cx)
}
redone
}
@ -1440,7 +1439,7 @@ impl Buffer {
if !ops.is_empty() {
for op in ops {
self.send_operation(Operation::Buffer(op), cx);
self.did_edit(&old_version, was_dirty, true, cx);
self.did_edit(&old_version, was_dirty, cx);
}
}
}