Skip to content

Commit 79f7076

Browse files
authored
Merge pull request #239 from ilmanzo/issue238
Fix issue #238
2 parents cba09bf + 630d92f commit 79f7076

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/lib.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,8 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
733733
writeln!(self.writer)?;
734734
} else if let Some(n) = leftover {
735735
// last line is incomplete
736-
self.print_position_panel()?;
737736
self.squeezer = Squeezer::Ignore;
737+
self.print_position_panel()?;
738738
self.print_bytes()?;
739739
self.squeezer = Squeezer::Print;
740740
for i in n..8 * self.panels as usize {
@@ -939,4 +939,18 @@ mod tests {
939939
let actual_string: &str = str::from_utf8(&output).unwrap();
940940
assert_eq!(actual_string, expected_string)
941941
}
942+
943+
// issue#238
944+
#[test]
945+
fn display_offset_in_last_line() {
946+
let input = io::Cursor::new(b"AAAAAAAAAAAAAAAACCCC");
947+
let expected_string = "\
948+
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
949+
│00000000│ 41 41 41 41 41 41 41 41 ┊ 41 41 41 41 41 41 41 41 │AAAAAAAA┊AAAAAAAA│
950+
│00000010│ 43 43 43 43 ┊ │CCCC ┊ │
951+
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
952+
"
953+
.to_owned();
954+
assert_print_all_output(input, expected_string);
955+
}
942956
}

0 commit comments

Comments
 (0)