aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/editor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/ui/editor.rs')
-rw-r--r--helix-term/src/ui/editor.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 73dfd52c..43b1e7a0 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -1426,7 +1426,15 @@ impl Component for EditorView {
Event::Mouse(event) => self.handle_mouse_event(event, &mut cx),
Event::IdleTimeout => self.handle_idle_timeout(&mut cx),
- Event::FocusGained | Event::FocusLost => EventResult::Ignored(None),
+ Event::FocusGained => EventResult::Ignored(None),
+ Event::FocusLost => {
+ if context.editor.config().auto_save {
+ if let Err(e) = commands::typed::write_all_impl(context, false, false) {
+ context.editor.set_error(format!("{}", e));
+ }
+ }
+ EventResult::Consumed(None)
+ }
}
}