From 7db7fba62e148302cb4b234b8dbb1b6fad40ca47 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Mon, 27 Feb 2023 15:51:06 +0100 Subject: style(fmt): rustfmt --- zellij-utils/src/input/actions.rs | 8 +++++++- zellij-utils/src/input/command.rs | 2 +- zellij-utils/src/input/layout.rs | 20 ++++++++++++++++---- zellij-utils/src/kdl/kdl_layout_parser.rs | 4 +++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/zellij-utils/src/input/actions.rs b/zellij-utils/src/input/actions.rs index 99c2553f9..a47e79f47 100644 --- a/zellij-utils/src/input/actions.rs +++ b/zellij-utils/src/input/actions.rs @@ -152,7 +152,13 @@ pub enum Action { /// If no direction is specified, will try to use the biggest available space. NewPane(Option, Option), // String is an optional pane name /// Open the file in a new pane using the default editor - EditFile(PathBuf, Option, Option, Option, bool), // usize is an optional line number, Option is an optional cwd, bool is floating true/false + EditFile( + PathBuf, + Option, + Option, + Option, + bool, + ), // usize is an optional line number, Option is an optional cwd, bool is floating true/false /// Open a new floating pane NewFloatingPane(Option, Option), // String is an optional pane name /// Open a new tiled (embedded, non-floating) pane diff --git a/zellij-utils/src/input/command.rs b/zellij-utils/src/input/command.rs index cb6fdb1ef..3d2a87ab3 100644 --- a/zellij-utils/src/input/command.rs +++ b/zellij-utils/src/input/command.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; #[derive(Debug, Clone)] pub enum TerminalAction { OpenFile(PathBuf, Option, Option), // path to file (should be absolute), optional line_number and an - // optional cwd + // optional cwd RunCommand(RunCommand), } diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 1ba9b735c..d6f5a2f7d 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -110,12 +110,24 @@ impl Run { Some(Run::Command(base_run_command)), Some(Run::EditFile(file_to_edit, line_number, edit_cwd)), ) => match &base_run_command.cwd { - Some(cwd) => Some(Run::EditFile(cwd.join(&file_to_edit), *line_number, Some(cwd.join(edit_cwd.clone().unwrap_or_default())))), - None => Some(Run::EditFile(file_to_edit.clone(), *line_number, edit_cwd.clone())), + Some(cwd) => Some(Run::EditFile( + cwd.join(&file_to_edit), + *line_number, + Some(cwd.join(edit_cwd.clone().unwrap_or_default())), + )), + None => Some(Run::EditFile( + file_to_edit.clone(), + *line_number, + edit_cwd.clone(), + )), }, (Some(Run::Cwd(cwd)), Some(Run::EditFile(file_to_edit, line_number, edit_cwd))) => { let cwd = edit_cwd.clone().unwrap_or(cwd.clone()); - Some(Run::EditFile(cwd.join(&file_to_edit), *line_number, Some(cwd))) + Some(Run::EditFile( + cwd.join(&file_to_edit), + *line_number, + Some(cwd), + )) }, (Some(_base), Some(other)) => Some(other.clone()), (Some(base), _) => Some(base.clone()), @@ -140,7 +152,7 @@ impl Run { }, None => { let _ = edit_cwd.insert(cwd.clone()); - } + }, }; *path_to_file = cwd.join(&path_to_file); }, diff --git a/zellij-utils/src/kdl/kdl_layout_parser.rs b/zellij-utils/src/kdl/kdl_layout_parser.rs index 402dede99..cf6afaf70 100644 --- a/zellij-utils/src/kdl/kdl_layout_parser.rs +++ b/zellij-utils/src/kdl/kdl_layout_parser.rs @@ -374,7 +374,9 @@ impl<'a> KdlLayoutParser<'a> { hold_on_close, hold_on_start, }))), - (None, Some(edit), Some(cwd)) => Ok(Some(Run::EditFile(cwd.join(edit), None, Some(cwd)))), + (None, Some(edit), Some(cwd)) => { + Ok(Some(Run::EditFile(cwd.join(edit), None, Some(cwd)))) + }, (None, Some(edit), None) => Ok(Some(Run::EditFile(edit, None, None))), (Some(_command), Some(_edit), _) => Err(ConfigError::new_layout_kdl_error( "cannot have both a command and an edit instruction for the same pane".into(), -- cgit v1.2.3