aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorWojciech Kępka2021-06-13 09:54:00 +0000
committerBlaž Hrastnik2021-06-13 11:48:18 +0000
commitdf217f71c15d95f75e7a716ab458f6c23db313d2 (patch)
treecb9b7b1a20d2c77a7d37924652478920c33fa9b3 /helix-term/src
parentd008e860379df590cd2a948ec490351ed30ca5b1 (diff)
Fix `wq`
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 38f4ce10..6111dd7b 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -949,9 +949,7 @@ mod cmd {
};
}
if doc.path().is_none() {
- return Err(anyhow!(
- "cannot write a buffer without a filename".to_string()
- ));
+ return Err(anyhow!("cannot write a buffer without a filename"));
}
let autofmt = doc
.language_config()
@@ -1006,8 +1004,12 @@ mod cmd {
}
fn write_quit(editor: &mut Editor, args: &[&str], event: PromptEvent) {
- write(editor, args, event);
- quit(editor, &[], event);
+ let (view, doc) = editor.current();
+ if let Err(e) = _write(view, doc, args.first()) {
+ editor.set_error(e.to_string());
+ return;
+ };
+ quit(editor, &[], event)
}
fn force_write_quit(editor: &mut Editor, args: &[&str], event: PromptEvent) {