Skip to content

Color mode adds extraneous trailing spaces on every line #769

@jdanbrown

Description

@jdanbrown

Bug: Extraneous trailing spaces on every line, when color enabled

$ procs fish --use-config=default --color=always | cat --show-ends
 PID:▲ User │ TTY  CPU MEM CPU Time │ Command                  $
            │      [%] [%]          │                          $
 7193  danb │ s057 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 17848 danb │ s058 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 18687 danb │ s060 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 21944 danb │ s063 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 24395 danb │ s018 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish   $
 24499 danb │ s020 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish   $
 50665 danb │ s047 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 94874 danb │ s054 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$

Correct: No extraneous trailing spaces, when color disabled

$ procs fish --use-config=default --color=disable | cat --show-ends
 PID:▲ User │ TTY  CPU MEM CPU Time │ Command$
            │      [%] [%]          │$
 7193  danb │ s057 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 17848 danb │ s058 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 18687 danb │ s060 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 21944 danb │ s063 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 24395 danb │ s018 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish$
 24499 danb │ s020 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish$
 50665 danb │ s047 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$
 94874 danb │ s054 0.0 0.0 00:00:00 │ /opt/homebrew/bin/fish -l$

This is problematic when piping colored output (--color=always) to other commands (e.g. head), where some of the input processes that have very very long args (some always do), which results in line wrapping creating a ton of noisy blank lines from the large amount of trailing whitespace on every line:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions