Skip to content

Commit 603dbd6

Browse files
committed
Round match percent down before display
Ensures that 100% isn't displayed until it's a perfect match.
1 parent 6fb0a63 commit 603dbd6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

objdiff-gui/src/views/extab_diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub fn extab_diff_ui(ui: &mut egui::Ui, state: &mut DiffViewState, appearance: &
172172
{
173173
ui.colored_label(
174174
match_color_for_symbol(match_percent, appearance),
175-
format!("{match_percent:.0}%"),
175+
format!("{:.0}%", match_percent.floor()),
176176
);
177177
} else {
178178
ui.colored_label(appearance.replace_color, "Missing");

objdiff-gui/src/views/function_diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ pub fn function_diff_ui(ui: &mut egui::Ui, state: &mut DiffViewState, appearance
546546
{
547547
ui.colored_label(
548548
match_color_for_symbol(match_percent, appearance),
549-
format!("{match_percent:.0}%"),
549+
format!("{:.0}%", match_percent.floor()),
550550
);
551551
} else {
552552
ui.colored_label(appearance.replace_color, "Missing");

objdiff-gui/src/views/symbol_diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ fn symbol_ui(
284284
if let Some(match_percent) = symbol_diff.match_percent {
285285
write_text("(", appearance.text_color, &mut job, appearance.code_font.clone());
286286
write_text(
287-
&format!("{match_percent:.0}%"),
287+
&format!("{:.0}%", match_percent.floor()),
288288
match_color_for_symbol(match_percent, appearance),
289289
&mut job,
290290
appearance.code_font.clone(),
@@ -389,7 +389,7 @@ fn symbol_list_ui(
389389
appearance.code_font.clone(),
390390
);
391391
write_text(
392-
&format!("{match_percent:.0}%"),
392+
&format!("{:.0}%", match_percent.floor()),
393393
match_color_for_symbol(match_percent, appearance),
394394
&mut header,
395395
appearance.code_font.clone(),

0 commit comments

Comments
 (0)