mirror of
https://github.com/veeso/termscp.git
synced 2026-04-10 20:21:59 -07:00
280 feature request go to path auto completion (#287)
This commit is contained in:
committed by
GitHub
parent
8e2ffeabce
commit
3f01be3baa
@@ -13,6 +13,7 @@ use tuirealm::{AttrValue, Attribute, Sub, SubClause, SubEventClause};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use super::browser::{FileExplorerTab, FoundExplorerTab};
|
||||
use super::components::ATTR_FILES;
|
||||
use super::{components, Context, FileTransferActivity, Id};
|
||||
use crate::explorer::FileSorting;
|
||||
use crate::utils::ui::{Popup, Size};
|
||||
@@ -599,18 +600,40 @@ impl FileTransferActivity {
|
||||
}
|
||||
|
||||
pub(super) fn mount_goto(&mut self) {
|
||||
// get files
|
||||
let files = self
|
||||
.browser
|
||||
.explorer()
|
||||
.iter_files()
|
||||
.filter(|f| f.is_dir() || f.is_symlink())
|
||||
.map(|f| f.path().to_string_lossy().to_string())
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let input_color = self.theme().misc_input_dialog;
|
||||
assert!(self
|
||||
.app
|
||||
.remount(
|
||||
Id::GotoPopup,
|
||||
Box::new(components::GoToPopup::new(input_color)),
|
||||
Box::new(components::GotoPopup::new(input_color, files)),
|
||||
vec![],
|
||||
)
|
||||
.is_ok());
|
||||
assert!(self.app.active(&Id::GotoPopup).is_ok());
|
||||
}
|
||||
|
||||
pub(super) fn update_goto(&mut self, files: Vec<String>) {
|
||||
let payload = files
|
||||
.into_iter()
|
||||
.map(PropValue::Str)
|
||||
.collect::<Vec<PropValue>>();
|
||||
|
||||
let _ = self.app.attr(
|
||||
&Id::GotoPopup,
|
||||
Attribute::Custom(ATTR_FILES),
|
||||
AttrValue::Payload(PropPayload::Vec(payload)),
|
||||
);
|
||||
}
|
||||
|
||||
pub(super) fn umount_goto(&mut self) {
|
||||
let _ = self.app.umount(&Id::GotoPopup);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user