diff options
author | Michael Davis | 2022-06-05 10:48:16 +0000 |
---|---|---|
committer | GitHub | 2022-06-05 10:48:16 +0000 |
commit | 1c2aaf3bafd363ac5efd4befdb1d65bf5895769f (patch) | |
tree | 4d1fa73c849b236cc76ae1b97ce9e12091256217 | |
parent | d24ca66dbb5e67ed609f7b2cf11abaee05beaef7 (diff) |
ensure :quit and :quit! take no arguments (#2654)
-rw-r--r-- | helix-term/src/commands/typed.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 0b207f94..fd33e6b4 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -15,9 +15,11 @@ pub struct TypableCommand { fn quit( cx: &mut compositor::Context, - _args: &[Cow<str>], + args: &[Cow<str>], _event: PromptEvent, ) -> anyhow::Result<()> { + ensure!(args.is_empty(), ":quit takes no arguments"); + // last view and we have unsaved changes if cx.editor.tree.views().count() == 1 { buffers_remaining_impl(cx.editor)? @@ -30,9 +32,11 @@ fn quit( fn force_quit( cx: &mut compositor::Context, - _args: &[Cow<str>], + args: &[Cow<str>], _event: PromptEvent, ) -> anyhow::Result<()> { + ensure!(args.is_empty(), ":quit! takes no arguments"); + cx.editor.close(view!(cx.editor).id); Ok(()) |