Merge pull request #239 from ilmanzo/issue238

Fix issue #238
This commit is contained in:
David Peter authored and GitHub committed 2025-03-02 19:28:12 +01:00
commit 79f7076b02
1 file changed
+15 -1
+15 -1
View File
@@ -733,8 +733,8 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
writeln!(self.writer)?;
} else if let Some(n) = leftover {
// last line is incomplete
self.print_position_panel()?;
self.squeezer = Squeezer::Ignore;
self.print_position_panel()?;
self.print_bytes()?;
self.squeezer = Squeezer::Print;
for i in n..8 * self.panels as usize {
@@ -939,4 +939,18 @@ mod tests {
let actual_string: &str = str::from_utf8(&output).unwrap();
assert_eq!(actual_string, expected_string)
}
// issue#238
#[test]
fn display_offset_in_last_line() {
let input = io::Cursor::new(b"AAAAAAAAAAAAAAAACCCC");
let expected_string = "\
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 41 41 41 41 41 41 41 41 ┊ 41 41 41 41 41 41 41 41 │AAAAAAAA┊AAAAAAAA│
│00000010│ 43 43 43 43 ┊ │CCCC ┊ │
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
"
.to_owned();
assert_print_all_output(input, expected_string);
}
}