imgbot
Wojciech Kępka 3 years ago committed by Blaž Hrastnik
parent d008e86037
commit df217f71c1

@ -949,9 +949,7 @@ mod cmd {
}; };
} }
if doc.path().is_none() { if doc.path().is_none() {
return Err(anyhow!( return Err(anyhow!("cannot write a buffer without a filename"));
"cannot write a buffer without a filename".to_string()
));
} }
let autofmt = doc let autofmt = doc
.language_config() .language_config()
@ -1006,8 +1004,12 @@ mod cmd {
} }
fn write_quit(editor: &mut Editor, args: &[&str], event: PromptEvent) { fn write_quit(editor: &mut Editor, args: &[&str], event: PromptEvent) {
write(editor, args, event); let (view, doc) = editor.current();
quit(editor, &[], event); 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) { fn force_write_quit(editor: &mut Editor, args: &[&str], event: PromptEvent) {

Loading…
Cancel
Save