Coder Social home page Coder Social logo

hexd's People

Contributors

fireyfly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hexd's Issues

Misaligned rows (too few columns) with `-w 28`

There is some kind of interplay between -w and the chunk size that causes hexd to print misaligned lines in some cases.

E.g. hexd -w 28 -g 4 $(which hexd) shows this misalignment around BUFSIZ-sized chunks:

    ...
    03b8  63 00 00 00  12 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  45 01 00 00  c... .... .... .... .... .... E...
    03d4  20 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  a8 00 00 00  12 00 00 00   ... .... .... .... .... ยจ... ....
    03f0  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00                                         .... .... .... ....               
    0400  cc 00 00 00  12 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  89 00 00 00  รŒ... .... .... .... .... .... โ€ฐ...
    041c  12 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  e4 00 00 00  12 00 00 00  .... .... .... .... .... รค... ....
    ...

This appears to "only" be cosmetic, in that it doesn't look like the data being printed is corrupted (at least from first glance); no data seems to be missing/duplicated. A similar issue also affects pixd (with -w 28).

The issue appears to be that BUFSIZ-sized chunks are handled at a time, and each row only contains printed bytes from the same chunk. Thus, if the line width isn't a multiple of the chunk size, the last line within that chunk will be incomplete (in this case only displaying 16 bytes).

Reported by @zgrep.

feature: default to colour only when output is a tty

Currently, hexd unconditionally defaults to colourised output, and has the -p flag for turning colour off. A better option would be to default to detecting colour based on tty-ness (a la GNU --color=auto) and have explicit flags for turning colour on or off.

  • Could do GNU-style --color[=WHEN]. GNU ls defaults to no colours, but I think defaulting to colours if output is a tty is okay.
  • Could just default to auto and have explicit options. Which single-char flags would be appropriate for "no colours" and "yes colours"?
  • Either way, later flags should supersede earlier ones, to allow for alias hexd=hexd -p or similar.

feature: automatic `-w` width based on terminal width

Old hexd had this feature: default to automatically determining a width based on tty width (i.e. $COLUMNS, tput cols). It would look at the -g option and use the maximum number of groups per line that would fit. The upside is better terminal size utilization, but the downside is that a width of e.g. 0x18 might be less convenient than 0x10 (the usual default) because it offsets every other line, kinda.

I'm not sure I really liked this feature, but as I'm undecided I'm opening this issue to not forget to ponder it in the future. It could always be added as an optional thing controlled by an environment variable, but OTOH adding unwanted features seems like a recipe for feature creep/just general untidyness..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.