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

Weird output from colored output of utility #20

Open
juarezr opened this issue Nov 30, 2023 · 7 comments
Open

Weird output from colored output of utility #20

juarezr opened this issue Nov 30, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@juarezr
Copy link

juarezr commented Nov 30, 2023

Weird output from colored output of utility

Steps to reproduce

Using the eza utility to print with the util-linux column command works (with no colors only):

$ eza --recurse --level=2 --classify --time-style=iso --no-user --no-permissions --no-time --group-directories-first --long --color=never --grid --width 128 --tree | column
   - ./                                  837 │  └── snapcraft.yaml              2.5k ├── cliff.toml
   - ├── benches/                          - ├── src/                           5.5k ├── CODE_OF_CONDUCT.md
 369 │  └── my_benchmark.rs                - │  ├── fs/                         2.0k ├── column.sh*
   - ├── completions/                      - │  ├── info/                        361 ├── columnt.awk
   - │  ├── bash/                          - │  ├── options/                    8.1k ├── CONTRIBUTING.md
   - │  ├── fish/                          - │  ├── output/                     1.7k ├── deb.asc
   - │  ├── nush/                          - │  ├── theme/                       12k ├── deny.toml
   - │  └── zsh/                         192 │  ├── lib.rs                      2.5k ├── eza--grid.txt
   - ├── devtools/                      1.7k │  ├── logger.rs                   7.8k ├── flake.lock
5.6k │  ├── deb-package.sh*              17k │  └── main.rs                     9.0k ├── flake.nix
2.5k │  ├── dir-generator.sh               - ├── tests/                         6.2k ├── INSTALL.md
 861 │  └── generate-trycmd-test.sh*       - │  ├── cmd/                        7.1k ├── Justfile
   - ├── docs/                             - │  ├── gen/                        1.1k ├── LICENCE
   - │  ├── images/                        - │  ├── itest/                      2.6k ├── powertest.yaml
   - │  └── tapes/                         - │  ├── ptests/                     7.8k ├── README.md
   - ├── man/                            691 │  └── cli_tests.rs                 146 ├── rust-toolchain.toml
 12k │  ├── eza.1.md                    3.9k ├── build.rs                         34 ├── rustfmt.toml
2.5k │  ├── eza_colors-explanation.5.md  43k ├── Cargo.lock                      505 ├── SECURITY.md
7.3k │  └── eza_colors.5.md             3.2k ├── Cargo.toml                      586 └── treefmt.nix
   - ├── snap/                           29k ├── CHANGELOG.md

But when using column_ansi it looks weird:

$ eza --recurse --level=2 --classify --time-style=iso --no-user --no-permissions --no-time --group-directories-first --long --color=never --grid --width 128 --tree | column_ansi
                               -                    ./                         
                               -                    ├──                          benches/                
      369  │                                        └──                          my_benchmark.rs         
                               -                    ├──                          completions/            
                               -                    │                                                      ├──  bash/   
                               -                    │                                                      ├──  fish/   
                               -                    │                                                      ├──  nush/   
                               -                    │                                                      └──  zsh/    
                               -                    ├──                          devtools/               
5.6k  │                        ├──                  deb-package.sh*            
2.5k  │                        ├──                  dir-generator.sh           
      861  │                                        └──                          generate-trycmd-test.sh*
                               -                    ├──                          docs/                   
                               -                    │                                                      ├──  images/ 
                               -                    │                                                      └──  tapes/  
                               -                    ├──                          man/                    
      12k  │                                        ├──                          eza.1.md                
2.5k  │                        ├──                  eza_colors-explanation.5.md
7.3k  │                        └──                  eza_colors.5.md            
                               -                    ├──                          snap/                   
      837  │                                        └──                          snapcraft.yaml          
                               -                    ├──                          src/                    
                               -                    │                                                      ├──  fs/     
                               -                    │                                                      ├──  info/   
                               -                    │                                                      ├──  options/
                               -                    │                                                      ├──  output/ 
                               -                    │                                                      ├──  theme/  
      192  │                                        ├──                          lib.rs                  
1.7k  │                        ├──                  logger.rs                  
      17k  │                                        └──                          main.rs                 
                               -                    ├──                          tests/                  
                               -                    │                                                      ├──  cmd/    
                               -                    │                                                      ├──  gen/    
                               -                    │                                                      ├──  itest/  
                               -                    │                                                      ├──  ptests/ 
      691  │                                        └──                          cli_tests.rs            
3.9k  ├──  build.rs          
      43k  ├──                 Cargo.lock         
3.2k  ├──  Cargo.toml        
      29k  ├──                 CHANGELOG.md       
2.5k  ├──  cliff.toml        
5.5k  ├──  CODE_OF_CONDUCT.md
2.0k  ├──  column.sh*        
      361  ├──                 columnt.awk        
8.1k  ├──  CONTRIBUTING.md   
1.7k  ├──  deb.asc           
      12k  ├──                 deny.toml          
2.5k  ├──  eza--grid.txt     
7.8k  ├──  flake.lock        
9.0k  ├──  flake.nix         
6.2k  ├──  INSTALL.md        
7.1k  ├──  Justfile          
1.1k  ├──  LICENCE           
2.6k  ├──  powertest.yaml    
7.8k  ├──  README.md         
      146  ├──                 rust-toolchain.toml
           34                  ├──                  rustfmt.toml               
      505  ├──                 SECURITY.md        
      586  └──                 treefmt.nix        
@LukeSavefrogs
Copy link
Owner

LukeSavefrogs commented Dec 1, 2023

Interesting... I think this is related to #19...

If I recall correctly, I made a fix locally for that issue... I will check

Thank you for pointing this out anyway! 👌🏻

@LukeSavefrogs
Copy link
Owner

@juarezr Try running that command passing to column_ansi the following parameter: -s $"\t"

Tell me if this improves things

@LukeSavefrogs
Copy link
Owner

LukeSavefrogs commented Dec 2, 2023

@juarezr This issue should be fixed with the latest update, try it when you can 😃

This was caused by tab characters intermixed with spaces in the input string (by default it used a single space as input separator, whereas now uses a regex).

Please let me know if it fixes on your end too

@LukeSavefrogs LukeSavefrogs added the bug Something isn't working label Dec 2, 2023
@juarezr
Copy link
Author

juarezr commented Dec 2, 2023

Downloaded the latest version from main branch and got the following results:

tput cols; eza --recurse --level=2 --classify --time-style=iso --no-user --no-permissions --no-time --group-directories-first --long --color=never --grid --width 128 --tree | column
163
   - ./                                    - ├── man/                              - ├── tests/                         1.7k ├── deb.asc
   - ├── benches/                        12k │  ├── eza.1.md                       - │  ├── cmd/                         12k ├── deny.toml
 369 │  └── my_benchmark.rs             2.5k │  ├── eza_colors-explanation.5.md    - │  ├── gen/                        2.5k ├── eza--grid.txt
   - ├── completions/                   7.3k │  └── eza_colors.5.md                - │  ├── itest/                      7.8k ├── flake.lock
   - │  ├── bash/                          - ├── snap/                             - │  ├── ptests/                     9.0k ├── flake.nix
   - │  ├── fish/                        837 │  └── snapcraft.yaml               691 │  └── cli_tests.rs                6.2k ├── INSTALL.md
   - │  ├── nush/                          - ├── src/                           3.9k ├── build.rs                       7.1k ├── Justfile
   - │  └── zsh/                           - │  ├── fs/                          43k ├── Cargo.lock                     1.1k ├── LICENCE
   - ├── devtools/                         - │  ├── info/                       3.2k ├── Cargo.toml                     2.6k ├── powertest.yaml
5.6k │  ├── deb-package.sh*                - │  ├── options/                     29k ├── CHANGELOG.md                   7.8k ├── README.md
2.5k │  ├── dir-generator.sh               - │  ├── output/                     2.5k ├── cliff.toml                      146 ├── rust-toolchain.toml
 861 │  └── generate-trycmd-test.sh*       - │  ├── theme/                      5.5k ├── CODE_OF_CONDUCT.md               34 ├── rustfmt.toml
   - ├── docs/                           192 │  ├── lib.rs                      2.0k ├── column.sh*                      505 ├── SECURITY.md
   - │  ├── images/                     1.7k │  ├── logger.rs                    361 ├── columnt.awk                     586 └── treefmt.nix
   - │  └── tapes/                       17k │  └── main.rs                     8.1k ├── CONTRIBUTING.md
tput cols; eza --recurse --level=2 --classify --time-style=iso --no-user --no-permissions --no-time --group-directories-first --long --color=never --grid --width 128 --tree | column -s $"\t"
163
   - ./                                    - ├── man/                              - ├── tests/                         1.7k ├── deb.asc
   - ├── benches/                        12k │  ├── eza.1.md                       - │  ├── cmd/                         12k ├── deny.toml
 369 │  └── my_benchmark.rs             2.5k │  ├── eza_colors-explanation.5.md    - │  ├── gen/                        2.5k ├── eza--grid.txt
   - ├── completions/                   7.3k │  └── eza_colors.5.md                - │  ├── itest/                      7.8k ├── flake.lock
   - │  ├── bash/                          - ├── snap/                             - │  ├── ptests/                     9.0k ├── flake.nix
   - │  ├── fish/                        837 │  └── snapcraft.yaml               691 │  └── cli_tests.rs                6.2k ├── INSTALL.md
   - │  ├── nush/                          - ├── src/                           3.9k ├── build.rs                       7.1k ├── Justfile
   - │  └── zsh/                           - │  ├── fs/                          43k ├── Cargo.lock                     1.1k ├── LICENCE
   - ├── devtools/                         - │  ├── info/                       3.2k ├── Cargo.toml                     2.6k ├── powertest.yaml
5.6k │  ├── deb-package.sh*                - │  ├── options/                     29k ├── CHANGELOG.md                   7.8k ├── README.md
2.5k │  ├── dir-generator.sh               - │  ├── output/                     2.5k ├── cliff.toml                      146 ├── rust-toolchain.toml
 861 │  └── generate-trycmd-test.sh*       - │  ├── theme/                      5.5k ├── CODE_OF_CONDUCT.md               34 ├── rustfmt.toml
   - ├── docs/                           192 │  ├── lib.rs                      2.0k ├── column.sh*                      505 ├── SECURITY.md
   - │  ├── images/                     1.7k │  ├── logger.rs                    361 ├── columnt.awk                     586 └── treefmt.nix
   - │  └── tapes/                       17k │  └── main.rs                     8.1k ├── CONTRIBUTING.md
tput cols; eza --recurse --level=2 --classify --time-style=iso --no-user --no-permissions --no-time --group-directories-first --long --color=never --grid --width 128 --tree | column_ansi
163
      -    ./                
      -    ├──                 benches/                   
      369  │                   └──                          my_benchmark.rs         
      -    ├──                 completions/               
      -    │                   ├──                          bash/                   
      -    │                   ├──                          fish/                   
      -    │                   ├──                          nush/                   
      -    │                   └──                          zsh/                    
      -    ├──                 devtools/                  
5.6k  │    ├──                 deb-package.sh*            
2.5k  │    ├──                 dir-generator.sh           
      861  │                   └──                          generate-trycmd-test.sh*
      -    ├──                 docs/                      
      -    │                   ├──                          images/                 
      -    │                   └──                          tapes/                  
      -    ├──                 man/                       
      12k  │                   ├──                          eza.1.md                
2.5k  │    ├──                 eza_colors-explanation.5.md
7.3k  │    └──                 eza_colors.5.md            
      -    ├──                 snap/                      
      837  │                   └──                          snapcraft.yaml          
      -    ├──                 src/                       
      -    │                   ├──                          fs/                     
      -    │                   ├──                          info/                   
      -    │                   ├──                          options/                
      -    │                   ├──                          output/                 
      -    │                   ├──                          theme/                  
      192  │                   ├──                          lib.rs                  
1.7k  │    ├──                 logger.rs                  
      17k  │                   └──                          main.rs                 
      -    ├──                 tests/                     
      -    │                   ├──                          cmd/                    
      -    │                   ├──                          gen/                    
      -    │                   ├──                          itest/                  
      -    │                   ├──                          ptests/                 
      691  │                   └──                          cli_tests.rs            
3.9k  ├──  build.rs          
      43k  ├──                 Cargo.lock                 
3.2k  ├──  Cargo.toml        
      29k  ├──                 CHANGELOG.md               
2.5k  ├──  cliff.toml        
5.5k  ├──  CODE_OF_CONDUCT.md
2.0k  ├──  column.sh*        
      361  ├──                 columnt.awk                
8.1k  ├──  CONTRIBUTING.md   
1.7k  ├──  deb.asc           
      12k  ├──                 deny.toml                  
2.5k  ├──  eza--grid.txt     
7.8k  ├──  flake.lock        
9.0k  ├──  flake.nix         
6.2k  ├──  INSTALL.md        
7.1k  ├──  Justfile          
1.1k  ├──  LICENCE           
2.6k  ├──  powertest.yaml    
7.8k  ├──  README.md         
      146  ├──                 rust-toolchain.toml        
      34   ├──                 rustfmt.toml               
      505  ├──                 SECURITY.md                
      586  └──                 treefmt.nix
 tput cols; eza --recurse --level=2 --classify --time-style=iso --no-user --no-permissions --no-time --group-directories-first --long --color=never --grid --width 128 --tree | column_ansi -s $"\t"
163
   - ./                                
   - ├── benches/                      
 369 │  └── my_benchmark.rs            
   - ├── completions/                  
   - │  ├── bash/                      
   - │  ├── fish/                      
   - │  ├── nush/                      
   - │  └── zsh/                       
   - ├── devtools/                     
5.6k │  ├── deb-package.sh*            
2.5k │  ├── dir-generator.sh           
 861 │  └── generate-trycmd-test.sh*   
   - ├── docs/                         
   - │  ├── images/                    
   - │  └── tapes/                     
   - ├── man/                          
 12k │  ├── eza.1.md                   
2.5k │  ├── eza_colors-explanation.5.md
7.3k │  └── eza_colors.5.md            
   - ├── snap/                         
 837 │  └── snapcraft.yaml             
   - ├── src/                          
   - │  ├── fs/                        
   - │  ├── info/                      
   - │  ├── options/                   
   - │  ├── output/                    
   - │  ├── theme/                     
 192 │  ├── lib.rs                     
1.7k │  ├── logger.rs                  
 17k │  └── main.rs                    
   - ├── tests/                        
   - │  ├── cmd/                       
   - │  ├── gen/                       
   - │  ├── itest/                     
   - │  ├── ptests/                    
 691 │  └── cli_tests.rs               
3.9k ├── build.rs                      
 43k ├── Cargo.lock                    
3.2k ├── Cargo.toml                    
 29k ├── CHANGELOG.md                  
2.5k ├── cliff.toml                    
5.5k ├── CODE_OF_CONDUCT.md            
2.0k ├── column.sh*                    
 361 ├── columnt.awk                   
8.1k ├── CONTRIBUTING.md               
1.7k ├── deb.asc                       
 12k ├── deny.toml                     
2.5k ├── eza--grid.txt                 
7.8k ├── flake.lock                    
9.0k ├── flake.nix                     
6.2k ├── INSTALL.md                    
7.1k ├── Justfile                      
1.1k ├── LICENCE                       
2.6k ├── powertest.yaml                
7.8k ├── README.md                     
 146 ├── rust-toolchain.toml           
  34 ├── rustfmt.toml                  
 505 ├── SECURITY.md                   
 586 └── treefmt.nix
tput cols; eza --recurse --level=2 --classify --time-style=iso --no-user --no-permissions --no-time --group-directories-first --long --color=always --grid --width 128 --tree | column_ansi
163
      -    ./                
      -    ├──                 benches/                   
      369  │                   └──                          my_benchmark.rs         
      -    ├──                 completions/               
      -    │                   ├──                          bash/                   
      -    │                   ├──                          fish/                   
      -    │                   ├──                          nush/                   
      -    │                   └──                          zsh/                    
      -    ├──                 devtools/                  
5.6k  │    ├──                 deb-package.sh*            
2.5k  │    ├──                 dir-generator.sh           
      861  │                   └──                          generate-trycmd-test.sh*
      -    ├──                 docs/                      
      -    │                   ├──                          images/                 
      -    │                   └──                          tapes/                  
      -    ├──                 man/                       
      12k  │                   ├──                          eza.1.md                
2.5k  │    ├──                 eza_colors-explanation.5.md
7.3k  │    └──                 eza_colors.5.md            
      -    ├──                 snap/                      
      837  │                   └──                          snapcraft.yaml          
      -    ├──                 src/                       
      -    │                   ├──                          fs/                     
      -    │                   ├──                          info/                   
      -    │                   ├──                          options/                
      -    │                   ├──                          output/                 
      -    │                   ├──                          theme/                  
      192  │                   ├──                          lib.rs                  
1.7k  │    ├──                 logger.rs                  
      17k  │                   └──                          main.rs                 
      -    ├──                 tests/                     
      -    │                   ├──                          cmd/                    
      -    │                   ├──                          gen/                    
      -    │                   ├──                          itest/                  
      -    │                   ├──                          ptests/                 
      691  │                   └──                          cli_tests.rs            
3.9k  ├──  build.rs          
      43k  ├──                 Cargo.lock                 
3.2k  ├──  Cargo.toml        
      29k  ├──                 CHANGELOG.md               
2.5k  ├──  cliff.toml        
5.5k  ├──  CODE_OF_CONDUCT.md
2.0k  ├──  column.sh*        
      361  ├──                 columnt.awk                
8.1k  ├──  CONTRIBUTING.md   
1.7k  ├──  deb.asc           
      12k  ├──                 deny.toml                  
2.5k  ├──  eza--grid.txt     
7.8k  ├──  flake.lock        
9.0k  ├──  flake.nix         
6.2k  ├──  INSTALL.md        
7.1k  ├──  Justfile          
1.1k  ├──  LICENCE           
2.6k  ├──  powertest.yaml    
7.8k  ├──  README.md         
      146  ├──                 rust-toolchain.toml        
      34   ├──                 rustfmt.toml               
      505  ├──                 SECURITY.md                
      586  └──                 treefmt.nix

@LukeSavefrogs
Copy link
Owner

LukeSavefrogs commented Dec 2, 2023

Thank you @juarezr for the followup 😄

Oh sorry! I just now noticed you're not using column -t!

The command column_ansi only supports the "table mode" of the original column (-t is implied if omitted). Try running column -t and probably you'll see the same output.

@LukeSavefrogs
Copy link
Owner

LukeSavefrogs commented Dec 3, 2023

The command column_ansi only supports the "table mode" of the original column (-t is implied if omitted). Try running column -t and probably you'll see the same output.

I just checked and I forgot to mention this in the README. 🤦🏻‍♂️

Also, the help is not clear too, since it allows omitting the -t parameter even if actually it ALWAYS has that behaviour. I've opened #22 to help making the documentation/help more clear and straightforward.

Sorry for the misunderstanding! 😳

@juarezr
Copy link
Author

juarezr commented Feb 19, 2024

Starting with the next version v2.40 of util-linux / column will handle text containing Fe Escape sequences from ANSI escape code properly.

With util-linux/util-linux#2767, programs that output text with ANSI sequences will be handled correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants