mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
Show 0x00-bytes as '⋄' instead of '0', closes #166
This commit is contained in:
1 parent
c6af2edda8
commit
7d38f70918
3 files changed
+26
-29
No files matched your search
+5
-8
@@ -6,19 +6,16 @@
|
||||
- Added variable panels through the `--panels` and `--terminal-width` flags, see [#13](https://github.com/sharkdp/hexyl/issues/13) and [#164](https://github.com/sharkdp/hexyl/pull/164) (@sharifhsn)
|
||||
- Added new `--group-bytes`/`-g` option, see #104 and #170 (@RinHizakura)
|
||||
- Added new `--base B` option (where `B` can be `binary`, `octal`, `decimal` or `hexadecimal`), see #147 and #178 (@sharifhsn)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
|
||||
## Other
|
||||
|
||||
- More tests for the squeezing feature, see #177 (@mkatychev)
|
||||
|
||||
- Show actual zero bytes as `⋄` in the character panel (previously: `0`), in order not to confuse them with ASCII
|
||||
`0` bytes if colors are deactivated. Closes #166 (@sharkdp)
|
||||
|
||||
## `hexyl` as a library
|
||||
|
||||
- Breaking change: `Printer::new` is deprecated as a part of the public API. Alternatively, you can now construct a `Printer` using the `PrinterBuilder` builder API, see [#168](https://github.com/sharkdp/hexyl/pull/168). (@sharifhsn)
|
||||
|
||||
## Other
|
||||
|
||||
- More tests for the squeezing feature, see #177 (@mkatychev)
|
||||
|
||||
## Thank you
|
||||
|
||||
|
||||
+3
-3
@@ -82,7 +82,7 @@ impl Byte {
|
||||
use crate::ByteCategory::*;
|
||||
|
||||
match self.category() {
|
||||
Null => '0',
|
||||
Null => '⋄',
|
||||
AsciiPrintable => self.0 as char,
|
||||
AsciiWhitespace if self.0 == 0x20 => ' ',
|
||||
AsciiWhitespace => '_',
|
||||
@@ -819,9 +819,9 @@ mod tests {
|
||||
let input = io::Cursor::new(b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00");
|
||||
let expected_string = "\
|
||||
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
|
||||
│00000000│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │00000000┊00000000│
|
||||
│00000000│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
|
||||
│* │ ┊ │ ┊ │
|
||||
│00000020│ 00 ┊ │0 ┊ │
|
||||
│00000020│ 00 ┊ │⋄ ┊ │
|
||||
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
|
||||
"
|
||||
.to_owned();
|
||||
|
||||
+18
-18
@@ -90,8 +90,8 @@ mod length {
|
||||
.success()
|
||||
.stdout(
|
||||
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
|
||||
│00000000│ 7f 45 4c 46 02 01 01 00 ┊ 00 00 00 00 00 00 00 00 │•ELF•••0┊00000000│\n\
|
||||
│00000010│ 02 00 3e 00 01 00 00 00 ┊ 00 10 40 00 00 00 00 00 │•0>0•000┊0•@00000│\n\
|
||||
│00000000│ 7f 45 4c 46 02 01 01 00 ┊ 00 00 00 00 00 00 00 00 │•ELF•••⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│\n\
|
||||
│00000010│ 02 00 3e 00 01 00 00 00 ┊ 00 10 40 00 00 00 00 00 │•⋄>⋄•⋄⋄⋄┊⋄•@⋄⋄⋄⋄⋄│\n\
|
||||
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
|
||||
);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ mod display_offset {
|
||||
.success()
|
||||
.stdout(
|
||||
"┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐\n\
|
||||
│00000030│ 02 00 3e 00 01 00 00 00 ┊ 00 10 40 00 00 00 00 00 │•0>0•000┊0•@00000│\n\
|
||||
│00000030│ 02 00 3e 00 01 00 00 00 ┊ 00 10 40 00 00 00 00 00 │•⋄>⋄•⋄⋄⋄┊⋄•@⋄⋄⋄⋄⋄│\n\
|
||||
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘\n",
|
||||
);
|
||||
}
|
||||
@@ -442,11 +442,11 @@ mod group {
|
||||
.pretty_stdout(
|
||||
"\
|
||||
┌─────────────────────────┬─────────────────────────┬────────┬────────┐
|
||||
│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │00000000┊00000000│
|
||||
│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
|
||||
│* ┊ │ ┊ │
|
||||
│ ba 0e 00 00 00 b9 00 20 ┊ 40 00 bb 01 00 00 00 b8 │ו000×0 ┊@0ו000×│
|
||||
│ 04 00 00 00 cd 80 b8 01 ┊ 00 00 00 cd 80 00 00 00 │•000××ו┊000××000│
|
||||
│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │00000000┊00000000│
|
||||
│ ba 0e 00 00 00 b9 00 20 ┊ 40 00 bb 01 00 00 00 b8 │ו⋄⋄⋄×⋄ ┊@⋄ו⋄⋄⋄×│
|
||||
│ 04 00 00 00 cd 80 b8 01 ┊ 00 00 00 cd 80 00 00 00 │•⋄⋄⋄××ו┊⋄⋄⋄××⋄⋄⋄│
|
||||
│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
|
||||
│* ┊ │ ┊ │
|
||||
│* ┊ │ ┊ │
|
||||
└─────────────────────────┴─────────────────────────┴────────┴────────┘
|
||||
@@ -467,13 +467,13 @@ mod group {
|
||||
.pretty_stdout(
|
||||
"\
|
||||
┌─────────────────────────┬────────┐
|
||||
│ 00 00 00 00 00 00 00 00 │00000000│
|
||||
│ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄│
|
||||
│* │ │
|
||||
│ ba 0e 00 00 00 b9 00 20 │ו000×0 │
|
||||
│ 40 00 bb 01 00 00 00 b8 │@0ו000×│
|
||||
│ 04 00 00 00 cd 80 b8 01 │•000××ו│
|
||||
│ 00 00 00 cd 80 00 00 00 │000××000│
|
||||
│ 00 00 00 00 00 00 00 00 │00000000│
|
||||
│ ba 0e 00 00 00 b9 00 20 │ו⋄⋄⋄×⋄ │
|
||||
│ 40 00 bb 01 00 00 00 b8 │@⋄ו⋄⋄⋄×│
|
||||
│ 04 00 00 00 cd 80 b8 01 │•⋄⋄⋄××ו│
|
||||
│ 00 00 00 cd 80 00 00 00 │⋄⋄⋄××⋄⋄⋄│
|
||||
│ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄│
|
||||
│* │ │
|
||||
│* │ │
|
||||
└─────────────────────────┴────────┘
|
||||
@@ -493,13 +493,13 @@ mod group {
|
||||
.pretty_stdout(
|
||||
"\
|
||||
┌────────┬─────────────────────────┬─────────────────────────┬─────────────────────────┬────────┬────────┬────────┐
|
||||
│00000400│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │00000000┊00000000┊00000000│
|
||||
│00000400│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
|
||||
│* │ ┊ ┊ │ ┊ ┊ │
|
||||
│00001000│ ba 0e 00 00 00 b9 00 20 ┊ 40 00 bb 01 00 00 00 b8 ┊ 04 00 00 00 cd 80 b8 01 │ו000×0 ┊@0ו000×┊•000××ו│
|
||||
│00001018│ 00 00 00 cd 80 00 00 00 ┊ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │000××000┊00000000┊00000000│
|
||||
│00001030│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │00000000┊00000000┊00000000│
|
||||
│00001000│ ba 0e 00 00 00 b9 00 20 ┊ 40 00 bb 01 00 00 00 b8 ┊ 04 00 00 00 cd 80 b8 01 │ו⋄⋄⋄×⋄ ┊@⋄ו⋄⋄⋄×┊•⋄⋄⋄××ו│
|
||||
│00001018│ 00 00 00 cd 80 00 00 00 ┊ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄××⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
|
||||
│00001030│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 00 00 00 00 │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
|
||||
│* │ ┊ ┊ │ ┊ ┊ │
|
||||
│000013f0│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 ┊ │00000000┊0000 ┊ │
|
||||
│000013f0│ 00 00 00 00 00 00 00 00 ┊ 00 00 00 00 ┊ │⋄⋄⋄⋄⋄⋄⋄⋄┊⋄⋄⋄⋄ ┊ │
|
||||
└────────┴─────────────────────────┴─────────────────────────┴─────────────────────────┴────────┴────────┴────────┘
|
||||
",
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user