From c7df782778dfa0a1d1199428ba2bb714b1f361aa Mon Sep 17 00:00:00 2001 From: Brian Orwe Date: Tue, 11 Oct 2022 16:25:42 +0300 Subject: [PATCH] Fix confusion with using --hsplit --vsplit on startup at same time (#4202) --- helix-term/src/args.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/helix-term/src/args.rs b/helix-term/src/args.rs index 48c866336fdb..dd787f1fd18c 100644 --- a/helix-term/src/args.rs +++ b/helix-term/src/args.rs @@ -32,8 +32,14 @@ impl Args { "--version" => args.display_version = true, "--help" => args.display_help = true, "--tutor" => args.load_tutor = true, - "--vsplit" => args.split = Some(Layout::Vertical), - "--hsplit" => args.split = Some(Layout::Horizontal), + "--vsplit" => match args.split { + Some(_) => anyhow::bail!("can only set a split once of a specific type"), + None => args.split = Some(Layout::Vertical), + }, + "--hsplit" => match args.split { + Some(_) => anyhow::bail!("can only set a split once of a specific type"), + None => args.split = Some(Layout::Horizontal), + }, "--health" => { args.health = true; args.health_arg = argv.next_if(|opt| !opt.starts_with('-'));