Skip to content

Commit

Permalink
Round match percent down before display
Browse files Browse the repository at this point in the history
Ensures that 100% isn't displayed until it's a
perfect match.
  • Loading branch information
encounter committed Oct 8, 2024
1 parent 6fb0a63 commit 603dbd6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion objdiff-gui/src/views/extab_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub fn extab_diff_ui(ui: &mut egui::Ui, state: &mut DiffViewState, appearance: &
{
ui.colored_label(
match_color_for_symbol(match_percent, appearance),
format!("{match_percent:.0}%"),
format!("{:.0}%", match_percent.floor()),
);
} else {
ui.colored_label(appearance.replace_color, "Missing");
Expand Down
2 changes: 1 addition & 1 deletion objdiff-gui/src/views/function_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ pub fn function_diff_ui(ui: &mut egui::Ui, state: &mut DiffViewState, appearance
{
ui.colored_label(
match_color_for_symbol(match_percent, appearance),
format!("{match_percent:.0}%"),
format!("{:.0}%", match_percent.floor()),
);
} else {
ui.colored_label(appearance.replace_color, "Missing");
Expand Down
4 changes: 2 additions & 2 deletions objdiff-gui/src/views/symbol_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ fn symbol_ui(
if let Some(match_percent) = symbol_diff.match_percent {
write_text("(", appearance.text_color, &mut job, appearance.code_font.clone());
write_text(
&format!("{match_percent:.0}%"),
&format!("{:.0}%", match_percent.floor()),
match_color_for_symbol(match_percent, appearance),
&mut job,
appearance.code_font.clone(),
Expand Down Expand Up @@ -389,7 +389,7 @@ fn symbol_list_ui(
appearance.code_font.clone(),
);
write_text(
&format!("{match_percent:.0}%"),
&format!("{:.0}%", match_percent.floor()),
match_color_for_symbol(match_percent, appearance),
&mut header,
appearance.code_font.clone(),
Expand Down

0 comments on commit 603dbd6

Please sign in to comment.