Include buffer's deferred ops when computing has_buffered_operations

This commit is contained in:
Antonio Scandurra 2022-02-28 14:20:25 +01:00
parent 720056d0db
commit abdfdcdabf
2 changed files with 25 additions and 10 deletions

View file

@ -405,12 +405,17 @@ impl Project {
}
#[cfg(any(test, feature = "test-support"))]
pub fn has_buffered_operations(&self) -> bool {
pub fn has_buffered_operations(&self, cx: &AppContext) -> bool {
self.buffers_state
.borrow()
.open_buffers
.values()
.any(|buffer| matches!(buffer, OpenBuffer::Loading(_)))
.any(|buffer| match buffer {
OpenBuffer::Loaded(buffer) => buffer
.upgrade(cx)
.map_or(false, |buffer| buffer.read(cx).deferred_ops_len() > 0),
OpenBuffer::Loading(_) => true,
})
}
#[cfg(any(test, feature = "test-support"))]