Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions objdiff-core/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,34 @@
}
]
},
{
"id": "preferredMatchingPercentSeparator",
"type": "choice",
"default": "parenthesis",
"name": "Change matching percent seperator",
"description": "Change the separator between a symbol's name and its matching percent.",
"items": [
{
"value": "parenthesis",
"name": "()"
},
{
"value": "pipe",
"name": "|"
},
{
"value": "dash",
"name": "-"
}
]
},
{
"id": "spacedMatchingPercent",
"type": "boolean",
"default": true,
"name": "Spaced Matching Percent",
"description": "Add spaces to align every matching percent on the right."
},
{
"id": "combineDataSections",
"type": "boolean",
Expand Down Expand Up @@ -394,6 +422,8 @@
"functionRelocDiffs",
"demangler",
"showSymbolSizes",
"preferredMatchingPercentSeparator",
"spacedMatchingPercent",
"spaceBetweenArgs",
"combineDataSections",
"combineTextSections"
Expand Down
8 changes: 7 additions & 1 deletion objdiff-gui/src/app_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use objdiff_core::{
config::ScratchConfig,
diff::{
ArmArchVersion, ArmR9Usage, DiffObjConfig, FunctionRelocDiffs, MipsAbi, MipsInstrCategory,
ShowSymbolSizes, X86Formatter,
PreferredMatchingPercentSeparator, ShowSymbolSizes, X86Formatter,
},
};
use typed_path::{Utf8PlatformPathBuf, Utf8UnixPathBuf};
Expand Down Expand Up @@ -228,6 +228,8 @@ pub struct DiffObjConfigV1 {
#[serde(default = "bool_true")]
pub space_between_args: bool,
pub show_symbol_sizes: ShowSymbolSizes,
pub preferred_matching_percent_separator: PreferredMatchingPercentSeparator,
pub spaced_matching_percent: bool,
pub combine_data_sections: bool,
// x86
pub x86_formatter: X86Formatter,
Expand All @@ -250,6 +252,8 @@ impl Default for DiffObjConfigV1 {
relax_reloc_diffs: false,
space_between_args: true,
show_symbol_sizes: Default::default(),
preferred_matching_percent_separator: Default::default(),
spaced_matching_percent: true,
combine_data_sections: false,
x86_formatter: Default::default(),
mips_abi: Default::default(),
Expand All @@ -275,6 +279,8 @@ impl DiffObjConfigV1 {
},
space_between_args: self.space_between_args,
show_symbol_sizes: self.show_symbol_sizes,
preferred_matching_percent_separator: self.preferred_matching_percent_separator,
spaced_matching_percent: self.spaced_matching_percent,
combine_data_sections: self.combine_data_sections,
x86_formatter: self.x86_formatter,
mips_abi: self.mips_abi,
Expand Down
27 changes: 23 additions & 4 deletions objdiff-gui/src/views/symbol_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use egui::{
use egui_extras::{Column, TableBuilder};
use objdiff_core::{
diff::{
DiffObjConfig, ObjectDiff, ShowSymbolSizes, SymbolDiff,
DiffObjConfig, ObjectDiff, PreferredMatchingPercentSeparator, ShowSymbolSizes, SymbolDiff,
display::{
HighlightKind, SectionDisplay, SymbolFilter, SymbolNavigationKind, display_sections,
symbol_context, symbol_hover,
Expand Down Expand Up @@ -722,14 +722,33 @@ fn symbol_ui(
write_text("] ", appearance.text_color, &mut job, appearance.code_font.clone());
}
if let Some(match_percent) = symbol_diff.match_percent {
write_text("(", appearance.text_color, &mut job, appearance.code_font.clone());
if diff_config.preferred_matching_percent_separator
== PreferredMatchingPercentSeparator::Parenthesis
{
write_text("(", appearance.text_color, &mut job, appearance.code_font.clone());
}
let formatted_percent = if diff_config.spaced_matching_percent {
&format!("{:3.0}%", match_percent.floor())
} else {
&format!("{:.0}%", match_percent.floor())
};
write_text(
&format!("{:.0}%", match_percent.floor()),
formatted_percent,
match_color_for_symbol(match_percent, appearance),
&mut job,
appearance.code_font.clone(),
);
write_text(") ", appearance.text_color, &mut job, appearance.code_font.clone());
let seperator = match diff_config.preferred_matching_percent_separator {
PreferredMatchingPercentSeparator::Parenthesis => ")",
PreferredMatchingPercentSeparator::Dash => " -",
PreferredMatchingPercentSeparator::Pipe => " |",
};
write_text(
&format!("{} ", seperator),
appearance.text_color,
&mut job,
appearance.code_font.clone(),
);
}
write_text(name, appearance.highlight_color, &mut job, appearance.code_font.clone());
if diff_config.show_symbol_sizes == ShowSymbolSizes::Decimal {
Expand Down
Loading