mookid / diffr

Yet another diff highlighting tool
MIT License
575 stars 22 forks source link

Feature req: Italics style support #18

Closed rpdelaney closed 4 years ago

rpdelaney commented 5 years ago

Not all terminals support italics, but the one I use does! I think it could make some intuitive styles for refined text.

rpdelaney commented 5 years ago

I can get this effect in my terminal with tput sitm and end with tput ritm.

There's also a dim effect with (appropriately) tput dim.

mookid commented 5 years ago

hi @rpdelaney ,

this is a feature request for termcolor. If the feature request lands there, I will be happy to support a new attribute.

I may give it a try but don't hold your breath.

rpdelaney commented 5 years ago

Third time's a charm.

It does look like crossterm supports more of these offbeat styles.

Would there be any way to allow a user to define their own pass-through values? Something like (just brainstorming here):

diffr --colors removed:background:124 \
  --rawcolors refine-removed:background:"$(tput setaf 124)":foreground:"$(tput dim ; tput setaf 15)"
rpdelaney commented 5 years ago

Nah that won't work, the shell will evaluate it before passing it to diffr. Maybe env vars would be better?

DIFFR_REFINE_REMOVED_BG="$(tput setaf 124)"
DIFFR_REFINE_REMOVED_FG="$(tput dim ; tput setaf 15)"
mookid commented 5 years ago

Nah that won't work, the shell will evaluate it before passing it to diffr. Maybe env vars would be better?

DIFFR_REFINE_REMOVED_BG="$(tput setaf 124)"
DIFFR_REFINE_REMOVED_FG="$(tput dim ; tput setaf 15)"

I would really avoid such solutions for the following reasons:

So progress on this will pass by improvements in diffr's dependencies.

rpdelaney commented 5 years ago

Fair enough. Thank you for filing the PR upstream. I'll follow that and leave it to you when to close this issue. Thanks! This is a neat tool.

rpdelaney commented 4 years ago

Thank you for running this down so diligently! Love this tool :)

mookid commented 4 years ago

I plan another trick in my bag for arbitrary ANSI escape code; stay tuned ;)

rpdelaney commented 4 years ago

Any chance there will be a release soon? I'm turning some of my colleagues on to using this with some styles I worked out for diffing terraform (since terraform-fmt constantly makes whitespace changes for alignment) but the releases in homebrew / AUR do not have all the features in the tip.

mookid commented 4 years ago

@rpdelaney done!

rpdelaney commented 4 years ago

https://github.com/Homebrew/homebrew-core/pull/51959