[RFE] Support squeezing like hexdump does
Steps to reproduce:
- Open a large file with large sections of zero blocks
- Have a look at the file
There there are large sections of zero blocks which make it hard to find the actually interesting content.
What should happen
Provide a way to allow the user to skip the large uninteresting blocks and concentrate on the interesting (high entropy) content. This could be done e.g. by adding the "squeeze mode" supported by
hexdump. In this mode,
hexdump hides repeating identical lines replacing it with a single line containing just an asterisk (
Of course, this should be an option (i.e. users must be able to disable squeezing).
Take any CD image. The first sector or so is zeros (from 0x0000 through 0x8000). GHex would display a few screen pages of zeros.
hexdump on the other hand would display this:
$ hexdump -C cdimage 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00008000 01 43 44 30 30 31 01 00 20 20 20 20 20 20 20 20 |.CD001.. |
This way, I'm starting right to the content and don't have to skip the first 0x8000 bytes manually. Regarding the UI, I propose to replace the asterisk by some text (e.g. "skipping the next 0x7543 identical bytes) or even better a GtkExpander which expands the skipped bytes on click.
This is a feature supported by
hexdump from the util-linux package. It is enabled by default there. See the
-v option of hexdump for details. Link to the hexdump source code and man page: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/text-utils.