mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:34 +00:00
Differentiate format on base
This commit is contained in:
1 parent
d5d645fc48
commit
85fa75ba67
1 file changed
+9
-2
+9
-2
@@ -299,11 +299,18 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
|
||||
Reset.render().to_string(),
|
||||
],
|
||||
border_style,
|
||||
byte_hex_panel: (0u8..=u8::MAX).map(|i| format!("{:02x}", i)).collect(),
|
||||
byte_hex_panel: (0u8..=u8::MAX)
|
||||
.map(|i| match base {
|
||||
Base::Binary => format!("{i:08b}"),
|
||||
Base::Octal => format!("{i:03o}"),
|
||||
Base::Decimal => format!("{i:03}"),
|
||||
Base::Hexadecimal => format!("{i:02x}"),
|
||||
})
|
||||
.collect(),
|
||||
byte_char_panel: (0u8..=u8::MAX)
|
||||
.map(|i| format!("{}", Byte(i).as_char()))
|
||||
.collect(),
|
||||
byte_hex_panel_g: (0u8..=u8::MAX).map(|i| format!("{:02x}", i)).collect(),
|
||||
byte_hex_panel_g: (0u8..=u8::MAX).map(|i| format!("{i:02x}")).collect(),
|
||||
byte_char_panel_g: (0u8..=u8::MAX)
|
||||
.map(|i| format!("{}", Byte(i).as_char()))
|
||||
.collect(),
|
||||
|
||||
Reference in new issue
Block a user