mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 09:16:38 -04:00
Fix unicode tag sorting
This commit is contained in:
parent
ee3c019804
commit
831942c2e2
1 changed files with 3 additions and 3 deletions
|
@ -28,7 +28,7 @@ pub struct Tag {
|
||||||
|
|
||||||
impl Ord for Tag {
|
impl Ord for Tag {
|
||||||
fn cmp(&self, other: &Self) -> Ordering {
|
fn cmp(&self, other: &Self) -> Ordering {
|
||||||
self.name.cmp(&other.name)
|
UniCase::new(&self.name).cmp(&UniCase::new(&other.name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ impl PartialOrd for Tag {
|
||||||
|
|
||||||
impl PartialEq for Tag {
|
impl PartialEq for Tag {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.name == other.name
|
self.cmp(other) == Ordering::Equal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ fn normalize_tag_name(name: &str) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fill_missing_tags(tags: Vec<Tag>) -> Vec<Tag> {
|
fn fill_missing_tags(tags: Vec<Tag>) -> Vec<Tag> {
|
||||||
let mut filled_tags: HashMap<String, Tag> = HashMap::new();
|
let mut filled_tags: HashMap<String, Tag> = HashMap::with_capacity(tags.len());
|
||||||
for tag in tags.into_iter() {
|
for tag in tags.into_iter() {
|
||||||
let name = tag.name.to_owned();
|
let name = tag.name.to_owned();
|
||||||
let split: Vec<&str> = (&tag.name).split("::").collect();
|
let split: Vec<&str> = (&tag.name).split("::").collect();
|
||||||
|
|
Loading…
Reference in a new issue