You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#~> lsd -a | wc
thread 'main' panicked at 'failed to retrieve terminal size', /home/yann/.cargo/registry/src/github.com-1ecc6299db9ec823/lsd-0.6.1/src/display.rs:29:21
Expected behavior: properly pipe contents to next program, expecting infinite width (e.g. "0")
Example 2
#~> lsd -al > test
Test now contains a lot of unprintable characters, e.g. it looks like this:
�[38;5;33md�[0m�[38;5;40mr�[38;5;192mw�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[0m �[38;5;230myann�[0m �[38;5;187musers�[0m �[38;5;229m 4 KB�[0m �[38;5;40mWed Dec 5 04:44:57 2018�[0m �[38;5;33m .git/�[0m
�[38;5;33md�[0m�[38;5;40mr�[38;5;192mw�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[0m �[38;5;230myann�[0m �[38;5;187musers�[0m �[38;5;229m 4 KB�[0m �[38;5;40mWed Dec 5 04:23:13 2018�[0m �[38;5;33m src/�[0m
�[38;5;33md�[0m�[38;5;40mr�[38;5;192mw�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[38;5;40mr�[38;5;168m-�[38;5;124mx�[0m �[38;5;230myann�[0m �[38;5;187musers�[0m �[38;5;229m 4 KB�[0m �[38;5;40mWed Dec 5 04:24:43 2018�[0m �[38;5;33m target/�[0m
�[38;5;184m.�[0m�[38;5;40mr�[38;5;192mw�[38;5;168m-�[38;5;40mr�[38;5;168m--�[38;5;40mr�[38;5;168m--�[0m �[38;5;230myann�[0m �[38;5;187musers�[0m �[38;5;229m 26 B �[0m �[38;5;40mWed Dec 5 04:23:13 2018�[0m �[38;5;184m .gitignore�[0m
�[38;5;184m.�[0m�[38;5;40mr�[38;5;192mw�[38;5;168m-�[38;5;40mr�[38;5;168m--�[38;5;40mr�[38;5;168m--�[0m �[38;5;230myann�[0m �[38;5;187musers�[0m �[38;5;229m 119 B �[0m �[38;5;40mWed Dec 5 04:23:13 2018�[0m �[38;5;184m .travis.yml�[0m
...
Expected behavior: don't print escape/color codes when not outputting to a terminal
Proposed solution
fetch terminal_size() at program startup and cache the result.
If term_size is None, disable color formatting for all outputs
If term_size is None, either set a reasonable default width for text files in print_grid or just default to print_one_per_line instead
The text was updated successfully, but these errors were encountered:
Example 1
Expected behavior: properly pipe contents to next program, expecting infinite width (e.g. "0")
Example 2
Test now contains a lot of unprintable characters, e.g. it looks like this:
Expected behavior: don't print escape/color codes when not outputting to a terminal
Proposed solution
terminal_size()
at program startup and cache the result.None
, disable color formatting for all outputsNone
, either set a reasonable default width for text files inprint_grid
or just default toprint_one_per_line
insteadThe text was updated successfully, but these errors were encountered: