mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
CTRL + G (goto directory)
This commit is contained in:
@@ -432,8 +432,17 @@ impl FileTransferActivity {
|
|||||||
'g' | 'G' => {
|
'g' | 'G' => {
|
||||||
// Goto
|
// Goto
|
||||||
// If ctrl is enabled...
|
// 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'm' | 'M' => {
|
||||||
|
// Make directory
|
||||||
|
// If ctrl is enabled...
|
||||||
if key.modifiers.intersects(KeyModifiers::CONTROL) {
|
if key.modifiers.intersects(KeyModifiers::CONTROL) {
|
||||||
// TODO:
|
// TODO:
|
||||||
|
//self.input_mode = InputMode::Popup(PopupType::Input(String::from("Insert directory name")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'r' | 'R' => {
|
'r' | 'R' => {
|
||||||
@@ -699,6 +708,22 @@ impl FileTransferActivity {
|
|||||||
self.input_mode = InputMode::Explorer;
|
self.input_mode = InputMode::Explorer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ### callback_change_directory
|
||||||
|
///
|
||||||
|
/// Callback for GOTO command
|
||||||
|
fn callback_change_directory(&mut self, context: &mut Context, input: String) {
|
||||||
|
match context.local.change_wrkdir(PathBuf::from(input.as_str())) {
|
||||||
|
Err(err) => {
|
||||||
|
// Report err
|
||||||
|
self.input_mode = InputMode::Popup(PopupType::Alert(
|
||||||
|
Color::Red,
|
||||||
|
format!("Could not change working directory: {}", err),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
Ok(_) => self.local.files = context.local.list_dir() // Update files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// ### callback_delete_fsentry
|
/// ### callback_delete_fsentry
|
||||||
///
|
///
|
||||||
/// Delete current selected fsentry in the currently selected TAB
|
/// Delete current selected fsentry in the currently selected TAB
|
||||||
|
|||||||
Reference in New Issue
Block a user