Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: query stdout terminal size to see if the output gose to a tty. #438

Merged
merged 8 commits into from
Oct 2, 2023

Commits on Sep 28, 2023

  1. fix: query stdout terminal size to see if the output gose to a tty.

    `terminal_size::terminal_size()` is used to determine if stdout is
    connected to a real tty/pty. In previous version of `terminal-size`,
    this method only queries the terminal size for `stdout`.
    However, it is changed in the following commit
    eminence/terminal-size@08f0e73
    Now the method will use `stdout, stdin, stderr`, trying its best to
    determine the terminal size. This cannot be used to determine if `eza`
    output is piped or redirected.
    We should use `terminal_size_using_fd` on `stdout.as_raw_fd` instead.
    
    Resolves eza-community#434 Fixes eza-community#433
    hehelego committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    427f975 View commit details
    Browse the repository at this point in the history
  2. fix: use windows-specific API for terminal size query on windows

    The previous commit 427f975 uses
    `terminal_size::terminal_size_using_fd` and `io::stdout().as_raw_fd()`
    which are only available on unix platform, creating compatibility issue
    for windows.
    In this commit, I leverage rust conditional compilation and
    `terminal_size::terminal_size_using_handle` to implement the same
    functionality for windows platform.
    hehelego committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    439e244 View commit details
    Browse the repository at this point in the history
  3. fix(cargo): add windows-sys dependency for targeting windows

    We use functions in this crate to get stdout handler for
    terminal size query.
    hehelego committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    ddd6850 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cf45b3e View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2023

  1. fix: use std::io::IsTerminal to eliminate compatibility issue

    Previsouly we tried to use `terminal_size_using_fd` on unix, and `terminal_size_using_handle` on windows to detect if stdout is connected to a terminal.
    This can be done by using `std::io::IsTerminal` on `std::io::stdout`, eliminating the need of conditional compiling.
    hehelego committed Sep 29, 2023
    Configuration menu
    Copy the full SHA
    c7aaecc View commit details
    Browse the repository at this point in the history
  2. fix(output): terminal size query should only check stdout

    Another API misuse. `terminal_size::terminal_size()` now looks into `stdout`, `stderr` and `stdin` to determine the terminal size with best effort.
    This is desirable for TUI applications, but not for CLI applications.
    `eza` only cares about the size of the terminal which is connected to standard output.
    We change this to `terminal_size_with_fd(stdout.as_raw_fd)` on unix, and `terminal_size_with_handle(STD_OUTPUT_HANDLE)` on windows.
    hehelego committed Sep 29, 2023
    Configuration menu
    Copy the full SHA
    9d834fb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c28e5b7 View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2023

  1. docs(README): change color to colo[u]r in the option description.

    `eza` manpage and `README` have been refering to this option as `--colo[u]r`. We should follow the tradition and keep the writing style consistent.
    
    Co-authored-by: MartinFillon <[email protected]>
    Signed-off-by: hehelego <[email protected]>
    hehelego and MartinFillon committed Oct 1, 2023
    Configuration menu
    Copy the full SHA
    2d58129 View commit details
    Browse the repository at this point in the history