on master help sign in
ensure :quit and :quit! take no arguments (#2654)
commit1c2aaf3bafd363ac5efd4befdb1d65bf5895769f authorMichael Davis <mcarsondavis@gmail.com> dateSun 5 Jun 2022, 05:48 (4 years ago) parentd24ca66
1 file changed+6−2
helix-term/src/commands/typed.rs+6−2
helix-term/src/commands/typed.rs+6−2
@@ -15,9 +15,11 @@ pub struct TypableCommand {
1515
1616fn quit(
1717 cx: &mut compositor::Context,
18− _args: &[Cow<str>],
18+ args: &[Cow<str>],
1919 _event: PromptEvent,
2020) -> anyhow::Result<()> {
21+ ensure!(args.is_empty(), ":quit takes no arguments");
22+
2123 // last view and we have unsaved changes
2224 if cx.editor.tree.views().count() == 1 {
2325 buffers_remaining_impl(cx.editor)?
@@ -30,9 +32,11 @@ fn quit(
3032
3133fn force_quit(
3234 cx: &mut compositor::Context,
33− _args: &[Cow<str>],
35+ args: &[Cow<str>],
3436 _event: PromptEvent,
3537) -> anyhow::Result<()> {
38+ ensure!(args.is_empty(), ":quit! takes no arguments");
39+
3640 cx.editor.close(view!(cx.editor).id);
3741
3842 Ok(())