sharkdp / hexyl

A command-line hex viewer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect output when reading from terminal

Aaron-Rumpler opened this issue · comments

Hexyl is giving incorrect output in some cases when reading terminal input. I've seen it when the input has multiple newlines at the end. The input of Test[Enter][Enter][Enter][Enter][CTRL-D] is one such case:

❯ hexyl
Test



┌────────┬─────────────────────────┬─────────────────────────┬────────┬────────┐
│00000000│ 54 65 73 74 0a 0a 00 00 ┊ 00 00 00 00 00 00 00 00 │Test__⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
│00000010│ 0a 0a 73 74 0a 0a 00 00 ┊ 00 00 00 00 00 00 00 00 │__st__⋄⋄┊⋄⋄⋄⋄⋄⋄⋄⋄│
└────────┴─────────────────────────┴─────────────────────────┴────────┴────────┘

I've been able to track it back to 15e8abf through 5f82942, with it being introduced in that set of changes.

I should probably mention I tested this on macOS 13.4 and tried from both Bash and ZSH in both iTerm2 and Terminal. Neither hexdump or commits before 15e8abf exhibit the issue.

commented

I can reproduce this issue on Linux. I'll take a look at it today, thanks for raising an issue!