aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2022-10-16 09:01:31 +0000
committerSkyler Hawthorne2022-10-19 02:31:39 +0000
commitb0212b36118f7a4d596510dabb0c011144c7af69 (patch)
treeca01cfc38639facdd93ae1eb176290eb5f6f4b34 /helix-view
parent30c93994b50888aaeb32c65c90426e997800ccea (diff)
Deduplicate flush_writes
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs15
1 files changed, 15 insertions, 0 deletions
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?
+ }
+ }
}