diff --git a/CHANGELOG.md b/CHANGELOG.md index fed74cd..c314c49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ Work in progress - file names are now sorted ignoring capital letters - file names longer than 23, are now cut to 20 and followed by `...` - paths which exceed tab size in explorer are elided with the following formato `ANCESTOR[1]/.../PARENT/DIRNAME` +- keybindings: + - `I`: show info about selected file or directory + - Removed `CTRL`; just use keys now. - bugfix: - prevent panic in set_progress, for progress values `> 100.0 or < 0.0` diff --git a/README.md b/README.md index 126b603..5713ecb 100644 --- a/README.md +++ b/README.md @@ -193,12 +193,13 @@ Password can be basically provided through 3 ways when address argument is provi | `` | Move down in selected list by 8 rows | | `` | Enter directory | | `` | Upload / download selected file | -| `` | Make directory | -| `` | Go to supplied path | -| `` | Show help | -| `` | Quit TermSCP | -| `` | Rename file | -| `` | Go to parent directory | +| `` | Make directory | +| `` | Go to supplied path | +| `` | Show help | +| `` | Show info about selected file or directory | +| `` | Quit TermSCP | +| `` | Rename file | +| `` | Go to parent directory | | `` | Delete file | --- diff --git a/src/ui/activities/filetransfer_activity/input.rs b/src/ui/activities/filetransfer_activity/input.rs index 82a1b5c..cdccf18 100644 --- a/src/ui/activities/filetransfer_activity/input.rs +++ b/src/ui/activities/filetransfer_activity/input.rs @@ -194,24 +194,18 @@ impl FileTransferActivity { } 'g' | 'G' => { // Goto - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - // Show input popup - self.input_mode = InputMode::Popup(PopupType::Input( - String::from("Change working directory"), - FileTransferActivity::callback_change_directory, - )); - } + // Show input popup + self.input_mode = InputMode::Popup(PopupType::Input( + String::from("Change working directory"), + FileTransferActivity::callback_change_directory, + )); } 'd' | 'D' => { // Make directory - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - self.input_mode = InputMode::Popup(PopupType::Input( - String::from("Insert directory name"), - FileTransferActivity::callback_mkdir, - )); - } + self.input_mode = InputMode::Popup(PopupType::Input( + String::from("Insert directory name"), + FileTransferActivity::callback_mkdir, + )); } 'h' | 'H' => { // Show help @@ -223,34 +217,25 @@ impl FileTransferActivity { } 'r' | 'R' => { // Rename - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - self.input_mode = InputMode::Popup(PopupType::Input( - String::from("Insert new name"), - FileTransferActivity::callback_rename, - )); - } + self.input_mode = InputMode::Popup(PopupType::Input( + String::from("Insert new name"), + FileTransferActivity::callback_rename, + )); } 's' | 'S' => { // Save as... - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - // Ask for input - self.input_mode = InputMode::Popup(PopupType::Input( - String::from("Save as..."), - FileTransferActivity::callback_save_as, - )); - } + // Ask for input + self.input_mode = InputMode::Popup(PopupType::Input( + String::from("Save as..."), + FileTransferActivity::callback_save_as, + )); } 'u' | 'U' => { // Go to parent directory - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - // Get pwd - let path: PathBuf = self.context.as_ref().unwrap().local.pwd(); - if let Some(parent) = path.as_path().parent() { - self.local_changedir(parent, true); - } + // Get pwd + let path: PathBuf = self.context.as_ref().unwrap().local.pwd(); + if let Some(parent) = path.as_path().parent() { + self.local_changedir(parent, true); } } ' ' => { @@ -411,24 +396,18 @@ impl FileTransferActivity { } 'g' | 'G' => { // Goto - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - // Show input popup - self.input_mode = InputMode::Popup(PopupType::Input( - String::from("Change working directory"), - FileTransferActivity::callback_change_directory, - )); - } + // Show input popup + self.input_mode = InputMode::Popup(PopupType::Input( + String::from("Change working directory"), + FileTransferActivity::callback_change_directory, + )); } 'd' | 'D' => { // Make directory - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - self.input_mode = InputMode::Popup(PopupType::Input( - String::from("Insert directory name"), - FileTransferActivity::callback_mkdir, - )); - } + self.input_mode = InputMode::Popup(PopupType::Input( + String::from("Insert directory name"), + FileTransferActivity::callback_mkdir, + )); } 'h' | 'H' => { // Show help @@ -440,43 +419,34 @@ impl FileTransferActivity { } 'r' | 'R' => { // Rename - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - self.input_mode = InputMode::Popup(PopupType::Input( - String::from("Insert new name"), - FileTransferActivity::callback_rename, - )); - } + self.input_mode = InputMode::Popup(PopupType::Input( + String::from("Insert new name"), + FileTransferActivity::callback_rename, + )); } 's' | 'S' => { // Save as... - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - // Ask for input - self.input_mode = InputMode::Popup(PopupType::Input( - String::from("Save as..."), - FileTransferActivity::callback_save_as, - )); - } + // Ask for input + self.input_mode = InputMode::Popup(PopupType::Input( + String::from("Save as..."), + FileTransferActivity::callback_save_as, + )); } 'u' | 'U' => { // Go to parent directory - // If ctrl is enabled... - if key.modifiers.intersects(KeyModifiers::CONTROL) { - // Get pwd - match self.client.pwd() { - Ok(path) => { - if let Some(parent) = path.as_path().parent() { - self.remote_changedir(parent, true); - } - } - Err(err) => { - self.input_mode = InputMode::Popup(PopupType::Alert( - Color::Red, - format!("Could not change working directory: {}", err), - )) + // Get pwd + match self.client.pwd() { + Ok(path) => { + if let Some(parent) = path.as_path().parent() { + self.remote_changedir(parent, true); } } + Err(err) => { + self.input_mode = InputMode::Popup(PopupType::Alert( + Color::Red, + format!("Could not change working directory: {}", err), + )) + } } } ' ' => { diff --git a/src/ui/activities/filetransfer_activity/layout.rs b/src/ui/activities/filetransfer_activity/layout.rs index 7287273..6640330 100644 --- a/src/ui/activities/filetransfer_activity/layout.rs +++ b/src/ui/activities/filetransfer_activity/layout.rs @@ -761,62 +761,72 @@ impl FileTransferActivity { ])), ListItem::new(Spans::from(vec![ Span::styled( - "", + "", Style::default() .fg(Color::Cyan) .add_modifier(Modifier::BOLD), ), - Span::raw(" "), + Span::raw(" "), Span::raw("make directory"), ])), ListItem::new(Spans::from(vec![ Span::styled( - "", + "", Style::default() .fg(Color::Cyan) .add_modifier(Modifier::BOLD), ), - Span::raw(" "), + Span::raw(" "), Span::raw("goto path"), ])), ListItem::new(Spans::from(vec![ Span::styled( - "", + "", Style::default() .fg(Color::Cyan) .add_modifier(Modifier::BOLD), ), - Span::raw(" "), + Span::raw(" "), Span::raw("show help"), ])), ListItem::new(Spans::from(vec![ Span::styled( - "", + "", Style::default() .fg(Color::Cyan) .add_modifier(Modifier::BOLD), ), - Span::raw(" "), + Span::raw(" "), + Span::raw("show info about the selected file or directory"), + ])), + ListItem::new(Spans::from(vec![ + Span::styled( + "", + Style::default() + .fg(Color::Cyan) + .add_modifier(Modifier::BOLD), + ), + Span::raw(" "), Span::raw("Quit TermSCP"), ])), ListItem::new(Spans::from(vec![ Span::styled( - "", + "", Style::default() .fg(Color::Cyan) .add_modifier(Modifier::BOLD), ), - Span::raw(" "), + Span::raw(" "), Span::raw("rename file"), ])), ListItem::new(Spans::from(vec![ Span::styled( - "", + "", Style::default() .fg(Color::Cyan) .add_modifier(Modifier::BOLD), ), - Span::raw(" "), + Span::raw(" "), Span::raw("go to parent directory"), ])), ];