sharkdp / hexyl

A command-line hex viewer
Apache License 2.0
8.93k stars 227 forks source link

Please don't print the header before input is seen #47

Closed FauxFaux closed 5 years ago

FauxFaux commented 5 years ago

hexyl appears to print the "header" (the top of the box) too soon.

If you have an app that thinks before printing output (e.g. gpg), it is unnecessarily ugly.

Something like this:

% (echo Er... >&2; sleep 0.2; \
 echo Thinking... >&2; sleep 0.2; \
 echo Um... >&2; sleep 0.2; \
 echo Output, finally; \
 echo 'Done!' >&2) | hexyl

Typically (it's racy!) looks like:

Er...
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
Thinking...
Um...
Done!
│00000000│ 4f 75 74 70 75 74 2c 20 ┊ 66 69 6e 61 6c 6c 79 0a │Output, ┊finally_│
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘

I'd rather it showed:

Er...
Thinking...
Um...
┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 4f 75 74 70 75 74 2c 20 ┊ 66 69 6e 61 6c 6c 79 0a │Output, ┊finally_│
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘
Done!

Gaming the thinking is probably easy. Gaming the Done! is probably impossible. (gpg doesn't print the done.)

sharkdp commented 5 years ago

Sounds good to me.

sharkdp commented 5 years ago

Fixed by @mziter in #51.