summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2022-09-22 23:32:35 +0200
committerCanop <cano.petrole@gmail.com>2022-09-22 23:34:56 +0200
commit0f5193f31eeeb9f6e721806fca8f3acde6b52da9 (patch)
tree3c8e433ba74864c220c7fa60fd2abe1f47114005 /src/display
parentb92b296030083e801cb54de56cfeb345ea1383ca (diff)
allow showing only file name on path searches
Using show_matching_characters_on_path_searches: false Fix #490
Diffstat (limited to 'src/display')
-rw-r--r--src/display/displayable_tree.rs38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/display/displayable_tree.rs b/src/display/displayable_tree.rs
index 0b310f2..5e8696e 100644
--- a/src/display/displayable_tree.rs
+++ b/src/display/displayable_tree.rs
@@ -305,23 +305,27 @@ impl<'a, 's, 't> DisplayableTree<'a, 's, 't> {
cw.queue_char(style, ' ')?;
cw.queue_char(style, ' ')?;
}
- if pattern_object.subpath && line.unlisted == 0 {
- let name_match = self.tree.options.pattern.pattern
- .search_string(&line.subpath);
- let mut path_ms = MatchedString::new(
- name_match,
- &line.subpath,
- style,
- char_match_style,
- );
- let name_ms = path_ms.split_on_last('/');
- cond_bg!(parent_style, self, selected, self.skin.parent);
- if name_ms.is_some() {
- path_ms.base_style = parent_style;
- }
- path_ms.queue_on(cw)?;
- if let Some(name_ms) = name_ms {
- name_ms.queue_on(cw)?;
+ if pattern_object.subpath {
+ if self.tree.options.show_matching_characters_on_path_searches && line.unlisted == 0 {
+ let name_match = self.tree.options.pattern.pattern
+ .search_string(&line.subpath);
+ let mut path_ms = MatchedString::new(
+ name_match,
+ &line.subpath,
+ style,
+ char_match_style,
+ );
+ let name_ms = path_ms.split_on_last('/');
+ cond_bg!(parent_style, self, selected, self.skin.parent);
+ if name_ms.is_some() {
+ path_ms.base_style = parent_style;
+ }
+ path_ms.queue_on(cw)?;
+ if let Some(name_ms) = name_ms {
+ name_ms.queue_on(cw)?;
+ }
+ } else {
+ cw.queue_str(style, &line.name)?;
}
} else {
let name_match = self.tree.options.pattern.pattern