Removed CTRL key; just press associated key to perform command

This commit is contained in:
ChristianVisintin
2020-12-10 10:28:40 +01:00
parent 145b778ff3
commit 7e6044a41b
4 changed files with 83 additions and 99 deletions

View File

@@ -16,6 +16,9 @@ Work in progress
- file names are now sorted ignoring capital letters - file names are now sorted ignoring capital letters
- file names longer than 23, are now cut to 20 and followed by `...` - 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` - 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: - bugfix:
- prevent panic in set_progress, for progress values `> 100.0 or < 0.0` - prevent panic in set_progress, for progress values `> 100.0 or < 0.0`

View File

@@ -193,12 +193,13 @@ Password can be basically provided through 3 ways when address argument is provi
| `<PGDOWN>` | Move down in selected list by 8 rows | | `<PGDOWN>` | Move down in selected list by 8 rows |
| `<ENTER>` | Enter directory | | `<ENTER>` | Enter directory |
| `<SPACE>` | Upload / download selected file | | `<SPACE>` | Upload / download selected file |
| `<CTRL+D>` | Make directory | | `<D>` | Make directory |
| `<CTRL+G>` | Go to supplied path | | `<G>` | Go to supplied path |
| `<CTRL+H>` | Show help | | `<H>` | Show help |
| `<CTRL+Q>` | Quit TermSCP | | `<H>` | Show info about selected file or directory |
| `<CTRL+R>` | Rename file | | `<Q>` | Quit TermSCP |
| `<CTRL+U>` | Go to parent directory | | `<R>` | Rename file |
| `<U>` | Go to parent directory |
| `<CANC>` | Delete file | | `<CANC>` | Delete file |
--- ---

View File

@@ -194,25 +194,19 @@ impl FileTransferActivity {
} }
'g' | 'G' => { 'g' | 'G' => {
// Goto // Goto
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
// Show input popup // Show input popup
self.input_mode = InputMode::Popup(PopupType::Input( self.input_mode = InputMode::Popup(PopupType::Input(
String::from("Change working directory"), String::from("Change working directory"),
FileTransferActivity::callback_change_directory, FileTransferActivity::callback_change_directory,
)); ));
} }
}
'd' | 'D' => { 'd' | 'D' => {
// Make directory // Make directory
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
self.input_mode = InputMode::Popup(PopupType::Input( self.input_mode = InputMode::Popup(PopupType::Input(
String::from("Insert directory name"), String::from("Insert directory name"),
FileTransferActivity::callback_mkdir, FileTransferActivity::callback_mkdir,
)); ));
} }
}
'h' | 'H' => { 'h' | 'H' => {
// Show help // Show help
self.input_mode = InputMode::Popup(PopupType::Help); self.input_mode = InputMode::Popup(PopupType::Help);
@@ -223,36 +217,27 @@ impl FileTransferActivity {
} }
'r' | 'R' => { 'r' | 'R' => {
// Rename // Rename
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
self.input_mode = InputMode::Popup(PopupType::Input( self.input_mode = InputMode::Popup(PopupType::Input(
String::from("Insert new name"), String::from("Insert new name"),
FileTransferActivity::callback_rename, FileTransferActivity::callback_rename,
)); ));
} }
}
's' | 'S' => { 's' | 'S' => {
// Save as... // Save as...
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
// Ask for input // Ask for input
self.input_mode = InputMode::Popup(PopupType::Input( self.input_mode = InputMode::Popup(PopupType::Input(
String::from("Save as..."), String::from("Save as..."),
FileTransferActivity::callback_save_as, FileTransferActivity::callback_save_as,
)); ));
} }
}
'u' | 'U' => { 'u' | 'U' => {
// Go to parent directory // Go to parent directory
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
// Get pwd // Get pwd
let path: PathBuf = self.context.as_ref().unwrap().local.pwd(); let path: PathBuf = self.context.as_ref().unwrap().local.pwd();
if let Some(parent) = path.as_path().parent() { if let Some(parent) = path.as_path().parent() {
self.local_changedir(parent, true); self.local_changedir(parent, true);
} }
} }
}
' ' => { ' ' => {
// Get pwd // Get pwd
let wrkdir: PathBuf = match self.client.pwd() { let wrkdir: PathBuf = match self.client.pwd() {
@@ -411,25 +396,19 @@ impl FileTransferActivity {
} }
'g' | 'G' => { 'g' | 'G' => {
// Goto // Goto
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
// Show input popup // Show input popup
self.input_mode = InputMode::Popup(PopupType::Input( self.input_mode = InputMode::Popup(PopupType::Input(
String::from("Change working directory"), String::from("Change working directory"),
FileTransferActivity::callback_change_directory, FileTransferActivity::callback_change_directory,
)); ));
} }
}
'd' | 'D' => { 'd' | 'D' => {
// Make directory // Make directory
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
self.input_mode = InputMode::Popup(PopupType::Input( self.input_mode = InputMode::Popup(PopupType::Input(
String::from("Insert directory name"), String::from("Insert directory name"),
FileTransferActivity::callback_mkdir, FileTransferActivity::callback_mkdir,
)); ));
} }
}
'h' | 'H' => { 'h' | 'H' => {
// Show help // Show help
self.input_mode = InputMode::Popup(PopupType::Help); self.input_mode = InputMode::Popup(PopupType::Help);
@@ -440,29 +419,21 @@ impl FileTransferActivity {
} }
'r' | 'R' => { 'r' | 'R' => {
// Rename // Rename
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
self.input_mode = InputMode::Popup(PopupType::Input( self.input_mode = InputMode::Popup(PopupType::Input(
String::from("Insert new name"), String::from("Insert new name"),
FileTransferActivity::callback_rename, FileTransferActivity::callback_rename,
)); ));
} }
}
's' | 'S' => { 's' | 'S' => {
// Save as... // Save as...
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
// Ask for input // Ask for input
self.input_mode = InputMode::Popup(PopupType::Input( self.input_mode = InputMode::Popup(PopupType::Input(
String::from("Save as..."), String::from("Save as..."),
FileTransferActivity::callback_save_as, FileTransferActivity::callback_save_as,
)); ));
} }
}
'u' | 'U' => { 'u' | 'U' => {
// Go to parent directory // Go to parent directory
// If ctrl is enabled...
if key.modifiers.intersects(KeyModifiers::CONTROL) {
// Get pwd // Get pwd
match self.client.pwd() { match self.client.pwd() {
Ok(path) => { Ok(path) => {
@@ -478,7 +449,6 @@ impl FileTransferActivity {
} }
} }
} }
}
' ' => { ' ' => {
// Get files // Get files
let files: Vec<FsEntry> = self.remote.files.clone(); // Otherwise self is borrowed both as mutable and immutable... let files: Vec<FsEntry> = self.remote.files.clone(); // Otherwise self is borrowed both as mutable and immutable...

View File

@@ -761,7 +761,7 @@ impl FileTransferActivity {
])), ])),
ListItem::new(Spans::from(vec![ ListItem::new(Spans::from(vec![
Span::styled( Span::styled(
"<CTRL+D>", "<D>",
Style::default() Style::default()
.fg(Color::Cyan) .fg(Color::Cyan)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),
@@ -771,7 +771,7 @@ impl FileTransferActivity {
])), ])),
ListItem::new(Spans::from(vec![ ListItem::new(Spans::from(vec![
Span::styled( Span::styled(
"<CTRL+G>", "<G>",
Style::default() Style::default()
.fg(Color::Cyan) .fg(Color::Cyan)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),
@@ -781,7 +781,7 @@ impl FileTransferActivity {
])), ])),
ListItem::new(Spans::from(vec![ ListItem::new(Spans::from(vec![
Span::styled( Span::styled(
"<CTRL+H>", "<H>",
Style::default() Style::default()
.fg(Color::Cyan) .fg(Color::Cyan)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),
@@ -791,7 +791,17 @@ impl FileTransferActivity {
])), ])),
ListItem::new(Spans::from(vec![ ListItem::new(Spans::from(vec![
Span::styled( Span::styled(
"<CTRL+Q>", "<I>",
Style::default()
.fg(Color::Cyan)
.add_modifier(Modifier::BOLD),
),
Span::raw(" "),
Span::raw("show info about the selected file or directory"),
])),
ListItem::new(Spans::from(vec![
Span::styled(
"<Q>",
Style::default() Style::default()
.fg(Color::Cyan) .fg(Color::Cyan)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),
@@ -801,7 +811,7 @@ impl FileTransferActivity {
])), ])),
ListItem::new(Spans::from(vec![ ListItem::new(Spans::from(vec![
Span::styled( Span::styled(
"<CTRL+R>", "<R>",
Style::default() Style::default()
.fg(Color::Cyan) .fg(Color::Cyan)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),
@@ -811,7 +821,7 @@ impl FileTransferActivity {
])), ])),
ListItem::new(Spans::from(vec![ ListItem::new(Spans::from(vec![
Span::styled( Span::styled(
"<CTRL+U>", "<U>",
Style::default() Style::default()
.fg(Color::Cyan) .fg(Color::Cyan)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),