summaryrefslogtreecommitdiffstats
path: root/src/app/tab.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/tab.rs')
-rw-r--r--src/app/tab.rs46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/app/tab.rs b/src/app/tab.rs
index 4f03311..875ade8 100644
--- a/src/app/tab.rs
+++ b/src/app/tab.rs
@@ -737,50 +737,4 @@ impl Tab {
self.tree.go(To::Path(&path));
Ok(())
}
-
- /// Search in current directory for an file whose name contains `searched_name`,
- /// from a starting position `next_index`.
- /// We search forward from that position and start again from top if nothing is found.
- /// We move the selection to the first matching file.
- pub fn search_from(&mut self, searched_pattern: &regex::Regex, current_index: usize) {
- if let Some(found_index) = self.search_from_index(searched_pattern, current_index) {
- self.go_to_index(found_index);
- } else if let Some(found_index) = self.search_from_top(searched_pattern, current_index) {
- self.go_to_index(found_index);
- }
- }
-
- /// Search a file by filename from given index, moving down
- fn search_from_index(
- &self,
- searched_pattern: &regex::Regex,
- current_index: usize,
- ) -> Option<usize> {
- for (index, file) in self.directory.enumerate().skip(current_index) {
- if searched_pattern.is_match(&file.filename) {
- return Some(index);
- }
- }
- None
- }
-
- /// Search a file by filename from first line, moving down
- fn search_from_top(
- &self,
- searched_pattern: &regex::Regex,
- current_index: usize,
- ) -> Option<usize> {
- for (index, file) in self.directory.enumerate().take(current_index) {
- if searched_pattern.is_match(&file.filename) {
- return Some(index);
- }
- }
- None
- }
-
- /// Search the next matching file in display directory
- pub fn normal_search_next(&mut self, search_pattern: &regex::Regex) {
- let next_index = (self.directory.index + 1) % self.directory.content.len();
- self.search_from(search_pattern, next_index);
- }
}