Skip to content

Commit 731b604

Browse files
authored
Fix highlighting of signed vs unsigned arguments (#202)
* Fix signed and unsigned arguments not being considered equal when highlighting * Remove unused Eq derive
1 parent 2d643eb commit 731b604

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

objdiff-core/src/diff/display.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<'a> DiffTextSegment<'a> {
7777
const EOL_SEGMENT: DiffTextSegment<'static> =
7878
DiffTextSegment { text: DiffText::Eol, color: DiffTextColor::Normal, pad_to: 0 };
7979

80-
#[derive(Debug, Default, Clone, PartialEq, Eq)]
80+
#[derive(Debug, Default, Clone)]
8181
pub enum HighlightKind {
8282
#[default]
8383
None,
@@ -288,6 +288,18 @@ pub fn display_row(
288288
Ok(())
289289
}
290290

291+
impl PartialEq<HighlightKind> for HighlightKind {
292+
fn eq(&self, other: &HighlightKind) -> bool {
293+
match (self, other) {
294+
(HighlightKind::Opcode(a), HighlightKind::Opcode(b)) => a == b,
295+
(HighlightKind::Argument(a), HighlightKind::Argument(b)) => a.loose_eq(b),
296+
(HighlightKind::Symbol(a), HighlightKind::Symbol(b)) => a == b,
297+
(HighlightKind::Address(a), HighlightKind::Address(b)) => a == b,
298+
_ => false,
299+
}
300+
}
301+
}
302+
291303
impl PartialEq<DiffText<'_>> for HighlightKind {
292304
fn eq(&self, other: &DiffText) -> bool {
293305
match (self, other) {

0 commit comments

Comments
 (0)