From 52ba550098745b463f59211a0172c334daef350b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= <blaz@mxxn.io>
Date: Mon, 17 Oct 2022 00:02:14 +0900
Subject: [PATCH] Use flush_writes in application.close()

---
 helix-term/src/application.rs | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 2e49e6d1..6ca5b657 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -977,18 +977,7 @@ impl Application {
             errs.push(err);
         };
 
-        for doc in self.editor.documents_mut() {
-            if let Some(Err(err)) = doc.close().await {
-                if let Some(path) = doc.path() {
-                    log::error!(
-                        "Error saving document '{}': {}",
-                        path.to_string_lossy(),
-                        err
-                    );
-                }
-                errs.push(err);
-            }
-        }
+        self.editor.flush_writes().await;
 
         if self.editor.close_language_servers(None).await.is_err() {
             log::error!("Timed out waiting for language servers to shutdown");