Make Buffer::apply_ops
infallible (#18089)
This PR makes the `Buffer::apply_ops` method infallible for `text::Buffer` and `language::Buffer`. We discovered that `text::Buffer::apply_ops` was only fallible due to `apply_undo`, which didn't actually need to be fallible. Release Notes: - N/A
This commit is contained in:
parent
8074fba76b
commit
1fc391f696
13 changed files with 85 additions and 108 deletions
|
@ -1972,7 +1972,7 @@ impl Buffer {
|
|||
&mut self,
|
||||
ops: I,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) -> Result<()> {
|
||||
) {
|
||||
self.pending_autoindent.take();
|
||||
let was_dirty = self.is_dirty();
|
||||
let old_version = self.version.clone();
|
||||
|
@ -1991,14 +1991,13 @@ impl Buffer {
|
|||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
self.text.apply_ops(buffer_ops)?;
|
||||
self.text.apply_ops(buffer_ops);
|
||||
self.deferred_ops.insert(deferred_ops);
|
||||
self.flush_deferred_ops(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();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn flush_deferred_ops(&mut self, cx: &mut ModelContext<Self>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue