Skip to content

Commit

Permalink
fix in outputting unicode offset #15
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed May 10, 2022
1 parent a0761f5 commit d346196
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pub struct Offset {

impl Offset {
pub fn convert(&mut self, map: &Vec<Option<usize>>) {
self.begin = map.get(self.begin).expect(format!("Offset {} must exist in map",self.begin).as_str()).expect("Offset in map may not be None");
self.end = map.get(self.end).expect(format!("Offset {} must exist in map",self.end).as_str()).expect("Offset in map may not be None");
self.begin = map.get(self.begin).expect(format!("Bytes to unicode: Begin offset {} must exist in map",self.begin).as_str()).expect("Offset in map may not be None");
self.end = map.get(self.end).expect(format!("Bytes to unicode: End offset {} must exist in map",self.end).as_str()).expect("Offset in map may not be None");
}
}

Expand Down Expand Up @@ -487,7 +487,7 @@ pub(crate) fn remap_offsets_to_unicodepoints<'a>(text: &'a str, mut matches: Vec
bytes2unicodepoints.push(None);
}
bytes2unicodepoints.push(Some(unicodeoffset));
end = unicodeoffset+1;
end = byteoffset+1;
}
//add an end offset
bytes2unicodepoints.push(Some(end));
Expand Down

0 comments on commit d346196

Please sign in to comment.