Round match percent down before display

Ensures that 100% isn't displayed until it's a
perfect match.
This commit is contained in:
Luke Street 2024-10-07 20:17:56 -06:00
parent 6fb0a63de2
commit 603dbd6882
3 changed files with 4 additions and 4 deletions

View File

@ -172,7 +172,7 @@ pub fn extab_diff_ui(ui: &mut egui::Ui, state: &mut DiffViewState, appearance: &
{ {
ui.colored_label( ui.colored_label(
match_color_for_symbol(match_percent, appearance), match_color_for_symbol(match_percent, appearance),
format!("{match_percent:.0}%"), format!("{:.0}%", match_percent.floor()),
); );
} else { } else {
ui.colored_label(appearance.replace_color, "Missing"); ui.colored_label(appearance.replace_color, "Missing");

View File

@ -546,7 +546,7 @@ pub fn function_diff_ui(ui: &mut egui::Ui, state: &mut DiffViewState, appearance
{ {
ui.colored_label( ui.colored_label(
match_color_for_symbol(match_percent, appearance), match_color_for_symbol(match_percent, appearance),
format!("{match_percent:.0}%"), format!("{:.0}%", match_percent.floor()),
); );
} else { } else {
ui.colored_label(appearance.replace_color, "Missing"); ui.colored_label(appearance.replace_color, "Missing");

View File

@ -284,7 +284,7 @@ fn symbol_ui(
if let Some(match_percent) = symbol_diff.match_percent { if let Some(match_percent) = symbol_diff.match_percent {
write_text("(", appearance.text_color, &mut job, appearance.code_font.clone()); write_text("(", appearance.text_color, &mut job, appearance.code_font.clone());
write_text( write_text(
&format!("{match_percent:.0}%"), &format!("{:.0}%", match_percent.floor()),
match_color_for_symbol(match_percent, appearance), match_color_for_symbol(match_percent, appearance),
&mut job, &mut job,
appearance.code_font.clone(), appearance.code_font.clone(),
@ -389,7 +389,7 @@ fn symbol_list_ui(
appearance.code_font.clone(), appearance.code_font.clone(),
); );
write_text( write_text(
&format!("{match_percent:.0}%"), &format!("{:.0}%", match_percent.floor()),
match_color_for_symbol(match_percent, appearance), match_color_for_symbol(match_percent, appearance),
&mut header, &mut header,
appearance.code_font.clone(), appearance.code_font.clone(),