diff --git a/src/print_text.rs b/src/print_text.rs index ea44754..806de21 100644 --- a/src/print_text.rs +++ b/src/print_text.rs @@ -4,6 +4,8 @@ use string_builder::Builder; use crate::structs::{config::{Field, Config}, data::Data}; +// TODO: update this function to apply a 'fuzzy' mode instead (possibly add config option). +// This would find the space character nearest the num_chars index and cut off there, allowing for cleaner truncation. fn cutoff(fields: &Vec, brk: char, strings: &mut HashMap) { for field in fields { if !field.field.eq("xesam:userRating") && !field.field.eq("xesam:autoRating") { diff --git a/src/structs/config.rs b/src/structs/config.rs index ca9b7f9..f72c40d 100644 --- a/src/structs/config.rs +++ b/src/structs/config.rs @@ -21,16 +21,6 @@ impl Field { } } -// I shouldn't need this; remove when done with testing FIXME -impl Default for Field { - fn default() -> Self { - Self { - field: Default::default(), - num_chars: Default::default() - } - } -} - #[derive(Serialize, Deserialize)] pub struct Rating { pub nil: char, diff --git a/src/update_message.rs b/src/update_message.rs index d58fe89..c138d86 100644 --- a/src/update_message.rs +++ b/src/update_message.rs @@ -82,7 +82,7 @@ pub fn update_message(pf: &PlayerFinder, cfg: &Config, data: &mut Data) { let key = field.field.clone(); let string = rating_to_string(m.get(&key), &cfg.rating_icons); if let Some(str) = string { - data.display_text.insert(field.field.clone(), str); + data.display_text.insert(key, str); } else { data.display_text.remove(&key); }