cli: Review builder fixes

Diff hunks were not being applied properly due to the line offsets
changing when a hunk was skipped.
This commit is contained in:
cloudhead
2023-12-14 10:50:38 +01:00
parent 99aeae19ea
commit c761d03a5a
2 changed files with 51 additions and 17 deletions
+9
View File
@@ -119,6 +119,15 @@ pub struct HunkHeader {
pub text: Vec<u8>,
}
impl TryFrom<&Hunk<Modification>> for HunkHeader {
type Error = Error;
fn try_from(hunk: &Hunk<Modification>) -> Result<Self, Self::Error> {
let mut r = io::BufReader::new(hunk.header.as_bytes());
Self::decode(&mut r)
}
}
impl HunkHeader {
pub fn old_line_range(&self) -> std::ops::Range<u32> {
let start: u32 = self.old_line_no;