4 ms·
Color/styled text is a weird case, since it tends to be used for improving output (e.g. highlighting a “diff” or code syntax). It can be annoying to have all t
by makecheck 9y ago
Color/styled text is a weird case, since it tends to be used for improving output (e.g. highlighting a “diff” or code syntax). It can be annoying to have all that helpful highlighting go away just because you added something like a pipe to “less” in your command to keep your text from scrolling away. The real problem is how a program is supposed to know when your pipe is meant to be interactive.
Technically terminals can play the interactive role in place of “less”: ^S/^Q, scrollback and search, etc. If that were more common, programs might not be misusing color/style sequences like this (as there wouldn’t be a common “interactive pipe” use case to support).
- jcoffland 9y agoUse 'less -r' to display ANSI color in less.
- racer-v 9y agoCrazy idea - what if other utilites were aware of ANSI codes and behaved appropriately? For example 'grep' could ignore color sequences when doing pattern-matching, and then re-apply the colors to the output. Then you could do something like `git log | grep` and see the original coloration in the output.
- dragonwriter 9y ago> Crazy idea - what if other utilites were aware of ANSI codes and behaved appropriately? If ANSI sequences were only color, they might be feasible; getting a clear idea on what “appropriately” means for general ANSI content in a text stream is... difficult.
- racer-v 9y agoI'd be happy with just the Graphic parameters https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_G...
- thisacctforreal 9y agoI wonder if tmux or iTerm2 could have an option to not autoscroll the command off the screen.