mirror of
https://github.com/veeso/termscp.git
synced 2026-04-10 20:21:59 -07:00
249 feature request better search results (#282)
* feat: issue 249 - fuzzy search replaced the old find explorer * fix: forgot to upload file * fix: removed debug
This commit is contained in:
committed by
GitHub
parent
c507d54700
commit
b2a8a3041c
@@ -177,11 +177,6 @@ impl FileTransferActivity {
|
||||
f.render_widget(Clear, popup);
|
||||
// make popup
|
||||
self.app.view(&Id::FilterPopup, f, popup);
|
||||
} else if self.app.mounted(&Id::FindPopup) {
|
||||
let popup = Popup(Size::Percentage(40), Size::Unit(3)).draw_in(f.size());
|
||||
f.render_widget(Clear, popup);
|
||||
// make popup
|
||||
self.app.view(&Id::FindPopup, f, popup);
|
||||
} else if self.app.mounted(&Id::GotoPopup) {
|
||||
let popup = Popup(Size::Percentage(40), Size::Unit(3)).draw_in(f.size());
|
||||
f.render_widget(Clear, popup);
|
||||
@@ -515,7 +510,7 @@ impl FileTransferActivity {
|
||||
let _ = self.app.umount(&Id::ExecPopup);
|
||||
}
|
||||
|
||||
pub(super) fn mount_find(&mut self, search: &str) {
|
||||
pub(super) fn mount_find(&mut self, msg: impl ToString, fuzzy_search: bool) {
|
||||
// Get color
|
||||
let (bg, fg, hg) = match self.browser.tab() {
|
||||
FileExplorerTab::Local | FileExplorerTab::FindLocal => (
|
||||
@@ -529,18 +524,29 @@ impl FileTransferActivity {
|
||||
self.theme().transfer_remote_explorer_highlighted,
|
||||
),
|
||||
};
|
||||
|
||||
// Mount component
|
||||
assert!(self
|
||||
.app
|
||||
.remount(
|
||||
Id::ExplorerFind,
|
||||
Box::new(components::ExplorerFind::new(
|
||||
format!(r#"Search results for "{search}""#),
|
||||
&[],
|
||||
bg,
|
||||
fg,
|
||||
hg
|
||||
)),
|
||||
if fuzzy_search {
|
||||
Box::new(components::ExplorerFuzzy::new(
|
||||
msg.to_string(),
|
||||
&[],
|
||||
bg,
|
||||
fg,
|
||||
hg,
|
||||
))
|
||||
} else {
|
||||
Box::new(components::ExplorerFind::new(
|
||||
msg.to_string(),
|
||||
&[],
|
||||
bg,
|
||||
fg,
|
||||
hg,
|
||||
))
|
||||
},
|
||||
vec![],
|
||||
)
|
||||
.is_ok());
|
||||
@@ -551,24 +557,6 @@ impl FileTransferActivity {
|
||||
let _ = self.app.umount(&Id::ExplorerFind);
|
||||
}
|
||||
|
||||
pub(super) fn mount_find_input(&mut self) {
|
||||
let input_color = self.theme().misc_input_dialog;
|
||||
assert!(self
|
||||
.app
|
||||
.remount(
|
||||
Id::FindPopup,
|
||||
Box::new(components::FindPopup::new(input_color)),
|
||||
vec![],
|
||||
)
|
||||
.is_ok());
|
||||
assert!(self.app.active(&Id::FindPopup).is_ok());
|
||||
}
|
||||
|
||||
pub(super) fn umount_find_input(&mut self) {
|
||||
// Umount input find
|
||||
let _ = self.app.umount(&Id::FindPopup);
|
||||
}
|
||||
|
||||
pub(super) fn mount_goto(&mut self) {
|
||||
let input_color = self.theme().misc_input_dialog;
|
||||
assert!(self
|
||||
@@ -1094,38 +1082,33 @@ impl FileTransferActivity {
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::SortingPopup,
|
||||
)))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::FindPopup,
|
||||
)))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::SyncBrowsingMkdirPopup,
|
||||
)))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::SymlinkPopup,
|
||||
)))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::SymlinkPopup,
|
||||
Id::WatcherPopup,
|
||||
)))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::WatcherPopup,
|
||||
Id::WatchedPathsList,
|
||||
)))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::WatchedPathsList,
|
||||
Id::ChmodPopup,
|
||||
)))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::ChmodPopup,
|
||||
Id::WaitPopup,
|
||||
)))),
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::FilterPopup,
|
||||
)))),
|
||||
Box::new(SubClause::And(
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::WaitPopup,
|
||||
)))),
|
||||
Box::new(SubClause::Not(Box::new(SubClause::IsMounted(
|
||||
Id::FilterPopup,
|
||||
)))),
|
||||
)),
|
||||
)),
|
||||
)),
|
||||
)),
|
||||
|
||||
Reference in New Issue
Block a user