fix(icons): use io::stdout().is_terminal() instead of terminal-width heuristic for --icons=auto#1849
Open
salarkhannn wants to merge 2 commits into
Open
Conversation
…yle value Replaces the unwrap() in TimeFormatParser::parse_ref with a proper clap InvalidUtf8 error, so a non-UTF-8 argument like --time-style "\xff\xfe" exits with code 2 instead of 134. Fixes eza-community#1837
…heuristic for auto behavior Fixes --icons=auto leaking icons when COLUMNS is set during a pipe. The is_tty flag was derived from width.actual_terminal_width().is_some(), which returns true whenever COLUMNS is set (via TerminalWidth::deduce), even when stdout is not a terminal. Use io::stdout().is_terminal() directly instead, which correctly returns false during a pipe. Also fixes default view (grid vs lines) when COLUMNS is set during a pipe — now correctly uses lines view instead of grid. Fixes eza-community#1842
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes the flag in
View::deducefrom being derived from terminal-width availability (width.actual_terminal_width().is_some()) to usingio::stdout().is_terminal()directly.The old heuristic returns
truewheneverCOLUMNSis set in the environment (viaTerminalWidth::deduce), even when stdout is piped to a file or another process. This caused--icons=autoto show icons in non-TTY output wheneverCOLUMNSwas set.Also fixes the default view (grid vs lines) selection when
COLUMNSis set during a pipe.Closes #1842