mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Go to parent directory with <BACKSPACE>
This commit is contained in:
@@ -381,27 +381,37 @@ impl FileTransferActivity {
|
|||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
// Match selected file
|
// Match selected file
|
||||||
if let Some(entry) = self.local.files.get(self.local.index) {
|
if let Some(entry) = self.local.files.get(self.local.index) {
|
||||||
match entry {
|
if let FsEntry::Directory(dir) = entry {
|
||||||
FsEntry::Directory(dir) => {
|
// Change directory
|
||||||
// Change directory
|
if let Err(err) = context.local.change_wrkdir(dir.abs_path.clone())
|
||||||
if let Err(err) =
|
{
|
||||||
context.local.change_wrkdir(dir.abs_path.clone())
|
// Report err
|
||||||
{
|
self.input_mode = InputMode::Popup(PopupType::Alert(
|
||||||
// Report err
|
Color::Red,
|
||||||
self.input_mode = InputMode::Popup(PopupType::Alert(
|
format!("Could not change working directory: {}", err),
|
||||||
Color::Red,
|
));
|
||||||
format!("Could not change working directory: {}", err),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
// Update files
|
|
||||||
self.local.files = context.local.list_dir();
|
|
||||||
}
|
|
||||||
FsEntry::File(file) => {
|
|
||||||
// TODO: upload file
|
|
||||||
}
|
}
|
||||||
|
// Update files
|
||||||
|
self.local.files = context.local.list_dir();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
KeyCode::Backspace => {
|
||||||
|
// Go previous directory
|
||||||
|
let wrkdir: PathBuf = context.local.pwd();
|
||||||
|
if let Some(parent) = wrkdir.as_path().parent() {
|
||||||
|
// Change directory
|
||||||
|
if let Err(err) = context.local.change_wrkdir(PathBuf::from(parent)) {
|
||||||
|
// Report err
|
||||||
|
self.input_mode = InputMode::Popup(PopupType::Alert(
|
||||||
|
Color::Red,
|
||||||
|
format!("Could not change working directory: {}", err),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
// Update files
|
||||||
|
self.local.files = context.local.list_dir();
|
||||||
|
}
|
||||||
|
}
|
||||||
KeyCode::Delete => {
|
KeyCode::Delete => {
|
||||||
// Get file at index
|
// Get file at index
|
||||||
if let Some(entry) = self.local.files.get(self.local.index) {
|
if let Some(entry) = self.local.files.get(self.local.index) {
|
||||||
@@ -433,6 +443,9 @@ impl FileTransferActivity {
|
|||||||
// TODO:
|
// TODO:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
' ' => {
|
||||||
|
// TODO: Upload file
|
||||||
|
}
|
||||||
_ => { /* Nothing to do */ }
|
_ => { /* Nothing to do */ }
|
||||||
},
|
},
|
||||||
_ => { /* Nothing to do */ }
|
_ => { /* Nothing to do */ }
|
||||||
|
|||||||
Reference in New Issue
Block a user