From b0212b36118f7a4d596510dabb0c011144c7af69 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sun, 16 Oct 2022 18:01:31 +0900 Subject: Deduplicate flush_writes --- helix-view/src/editor.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'helix-view') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index c4789ee2..c0efad05 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1348,4 +1348,19 @@ impl Editor { } } } + + pub async fn flush_writes(&mut self) { + while let Some(save_event) = self.save_queue.next().await { + match &save_event { + Ok(event) => { + let doc = doc_mut!(self, &event.doc_id); + doc.set_last_saved_revision(event.revision); + } + Err(err) => { + log::error!("error saving document: {}", err); + } + }; + // TODO: if is_err: break? + } + } } -- cgit v1.2.3-70-g09d2