Wilfred / difftastic

a structural diff that understands syntax 🟥🟩

Home Page:https://difftastic.wilfred.me.uk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide automatic display options that consider terminal width, etc.

olson-sean-k opened this issue · comments

difft provides several --display modes that configure how output is formatted and written to stdout. As of version 0.57.0, these essentially boil down to presenting diffs in either one or two columns, typically requiring less or more horizontal space, respectively. Terminal width can vary a lot in different environments though (terminal sessions, multiplexor windows, etc.), and sometimes the desired --display mode isn't ideal at a particular width. I think providing automatic display modes that can choose between modes based on terminal width (or even other variables) would be great.

I think a straightforward approach to this may be to introduce an auto option for --display and accompanying options to specify the narrow vs. wide width threshold, the narrow display mode, and the wide display mode (e.g., --display-auto-width, --display-auto-narrow, and --display-auto-wide or some such). This could of course be more sophisticated though and, for example, consider the maximum width of the text too. Features like that may also make configuration a bit unwieldy for command line arguments.

Thanks for taking a look and for difft. 😄 Thoughts?