Avoid creating redundant snapshots of channel notes buffers
Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
358a20494c
commit
c7c220309d
1 changed files with 3 additions and 1 deletions
|
@ -326,9 +326,11 @@ impl Database {
|
||||||
.ok_or_else(|| anyhow!("no such buffer"))?;
|
.ok_or_else(|| anyhow!("no such buffer"))?;
|
||||||
|
|
||||||
let (base_text, operations) = self.get_buffer_state(&buffer, tx).await?;
|
let (base_text, operations) = self.get_buffer_state(&buffer, tx).await?;
|
||||||
|
if operations.is_empty() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let mut text_buffer = text::Buffer::new(0, 0, base_text);
|
let mut text_buffer = text::Buffer::new(0, 0, base_text);
|
||||||
|
|
||||||
text_buffer
|
text_buffer
|
||||||
.apply_ops(operations.into_iter().filter_map(operation_from_wire))
|
.apply_ops(operations.into_iter().filter_map(operation_from_wire))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue