Skip to content

Commit

Permalink
Fix unused parent tags getting cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
abdnh committed Jul 12, 2024
1 parent 9d8782c commit 10040b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rslib/src/tags/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn is_tag_separator(c: char) -> bool {
}

pub(crate) fn immediate_parent_name_unicase(tag_name: UniCase<&str>) -> Option<UniCase<&str>> {
tag_name.rsplit_once('\x1f').map(|t| t.0).map(UniCase::new)
tag_name.rsplit_once("::").map(|t| t.0).map(UniCase::new)
}

fn immediate_parent_name_str(tag_name: &str) -> Option<&str> {
Expand Down
3 changes: 2 additions & 1 deletion rslib/src/tags/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ fn add_missing_parents(tags: &mut Vec<Tag>) {
}

fn tags_to_tree(mut tags: Vec<Tag>) -> TagTreeNode {

add_missing_parents(&mut tags);
for tag in &mut tags {
tag.name = tag.name.replace("::", "\x1f");
}
add_missing_parents(&mut tags);
tags.sort_unstable_by(|a, b| UniCase::new(&a.name).cmp(&UniCase::new(&b.name)));
let mut top = TagTreeNode::default();
let mut it = tags.into_iter().peekable();
Expand Down

0 comments on commit 10040b8

Please sign in to comment.