aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/application.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-06 10:02:22 +0000
committerBlaž Hrastnik2021-04-06 10:02:22 +0000
commit91462af546619740c93181b88a7908e481e6d6ab (patch)
tree24ba1aa03f68eda502c6831ff6f4d89dd1e0dfac /helix-term/src/application.rs
parentf00cb15137fdff72c2f08c4c6f43bfa96933433f (diff)
Allow starting hx without a file. A new blank file will be created.
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r--helix-term/src/application.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 53fd086b..396bd565 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -45,14 +45,17 @@ pub struct Application {
impl Application {
pub fn new(mut args: Args, executor: &'static smol::Executor<'static>) -> Result<Self, Error> {
+ use helix_view::editor::Action;
let mut compositor = Compositor::new()?;
let size = compositor.size();
let mut editor = Editor::new(executor, size);
- let files = args.values_of_t::<PathBuf>("files").unwrap();
- for file in files {
- use helix_view::editor::Action;
- editor.open(file, Action::HorizontalSplit)?;
+ if let Ok(files) = args.values_of_t::<PathBuf>("files") {
+ for file in files {
+ editor.open(file, Action::HorizontalSplit)?;
+ }
+ } else {
+ editor.new_file(Action::HorizontalSplit)?;
}
compositor.push(Box::new(ui::EditorView::new()));