diff options
author | qkzk <qu3nt1n@gmail.com> | 2024-01-06 23:15:30 +0100 |
---|---|---|
committer | qkzk <qu3nt1n@gmail.com> | 2024-01-06 23:15:30 +0100 |
commit | 45cd9e00d6b9710bb6c94708d34376e6d9a8d7a4 (patch) | |
tree | 66737ac01166f0ba086024ca107bf01ddfa8d461 /src | |
parent | 6c24e6e4b7dd807d9e2ea7542d9aec9ccc1c4e66 (diff) |
disable new nodes (file, dir)
Diffstat (limited to 'src')
-rw-r--r-- | src/event/event_exec.rs | 18 | ||||
-rw-r--r-- | src/modes/edit/permissions.rs | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/event/event_exec.rs b/src/event/event_exec.rs index 72814c0..c8974ac 100644 --- a/src/event/event_exec.rs +++ b/src/event/event_exec.rs @@ -273,12 +273,26 @@ impl EventAction { /// Enter the new dir mode. pub fn new_dir(status: &mut Status) -> Result<()> { - status.set_edit_mode(status.index, Edit::InputSimple(InputSimple::Newdir)) + if matches!( + status.current_tab().display_mode, + Display::Directory | Display::Tree + ) { + status.set_edit_mode(status.index, Edit::InputSimple(InputSimple::Newdir)) + } else { + Ok(()) + } } /// Enter the new file mode. pub fn new_file(status: &mut Status) -> Result<()> { - status.set_edit_mode(status.index, Edit::InputSimple(InputSimple::Newfile)) + if matches!( + status.current_tab().display_mode, + Display::Directory | Display::Tree + ) { + status.set_edit_mode(status.index, Edit::InputSimple(InputSimple::Newfile)) + } else { + Ok(()) + } } fn enter_file(status: &mut Status) -> Result<()> { diff --git a/src/modes/edit/permissions.rs b/src/modes/edit/permissions.rs index d31d5fe..ae7aee8 100644 --- a/src/modes/edit/permissions.rs +++ b/src/modes/edit/permissions.rs @@ -41,7 +41,6 @@ impl Permissions { for path in &flagged.content { Self::set_permissions(path, mode.octal())?; } - flagged.clear(); log_line!("Changed permissions to {mode_str}"); Ok(()) } |