1
Fork 0
mirror of https://github.com/RGBCube/dix synced 2025-05-14 02:24:58 +00:00

fix: fix bug in old-new comp printing

This commit is contained in:
RGBCube 2025-05-09 19:01:11 +03:00
parent 859c5fd363
commit c0e157841e
No known key found for this signature in database

View file

@ -216,22 +216,40 @@ pub fn write_diffln<'a>(
},
EitherOrBoth::Both(old_comp, new_comp) => {
if let Err(ignored) = old_comp {
write!(oldacc, "{ignored}")?;
let equal = old_comp == new_comp;
match old_comp {
Ok(old_comp) => {
write!(
oldacc,
"{old}",
old = if equal {
old_comp.yellow()
} else {
old_comp.red()
},
)?;
},
Err(ignored) => {
write!(oldacc, "{ignored}")?;
},
}
if let Err(ignored) = new_comp {
write!(newacc, "{ignored}")?;
}
if let (Ok(old_comp), Ok(new_comp)) = (old_comp, new_comp) {
if old_comp == new_comp {
write!(oldacc, "{old}", old = old_comp.yellow())?;
write!(newacc, "{new}", new = new_comp.yellow())?;
} else {
write!(oldacc, "{old}", old = old_comp.red())?;
write!(newacc, "{new}", new = new_comp.green())?;
}
match new_comp {
Ok(new_comp) => {
write!(
newacc,
"{new}",
new = if equal {
new_comp.yellow()
} else {
new_comp.green()
},
)?;
},
Err(ignored) => {
write!(newacc, "{ignored}")?;
},
}
},
}