diff options
author | Canop <cano.petrole@gmail.com> | 2021-12-31 18:19:56 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2021-12-31 18:20:49 +0100 |
commit | 22dfebe356134e736e8534dd35661f5a5ad18edc (patch) | |
tree | 1217360eccdbcbfb5c7ccd14ceb49003c2eb31eb /src | |
parent | 22908e0dfef18e8accf9a2125f8349b448aea2e6 (diff) |
total_search shows all matches
This is experimental and might be reversed in a future version
Diffstat (limited to 'src')
-rw-r--r-- | src/pattern/fuzzy_pattern.rs | 4 | ||||
-rw-r--r-- | src/tree_build/builder.rs | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/pattern/fuzzy_pattern.rs b/src/pattern/fuzzy_pattern.rs index 2bc28f1..457b5bc 100644 --- a/src/pattern/fuzzy_pattern.rs +++ b/src/pattern/fuzzy_pattern.rs @@ -181,8 +181,8 @@ impl FuzzyPattern { } let mut best_score = 0; let mut best_match: Option<NameMatch> = None; - let n = cand_chars.len() - self.chars.len(); - for start_idx in 0..=n { + let n = cand_chars.len() + 1 - self.chars.len(); + for start_idx in 0..n { if cand_chars[start_idx] == self.chars[0] { match self.tight_match_from_index(&cand_chars, start_idx) { MatchSearchResult::Perfect(m) => { diff --git a/src/tree_build/builder.rs b/src/tree_build/builder.rs index 37e406b..c091879 100644 --- a/src/tree_build/builder.rs +++ b/src/tree_build/builder.rs @@ -447,7 +447,10 @@ impl<'c> TreeBuilder<'c> { pub fn build(mut self, total_search: bool, dam: &Dam) -> Option<Tree> { match self.gather_lines(total_search, dam) { Some(out_blines) => { - self.trim_excess(&out_blines); + debug!("blines before trimming: {}", out_blines.len()); + if !self.total_search { + self.trim_excess(&out_blines); + } Some(self.take(&out_blines)) } None => None, // interrupted |