dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
22.74k stars 380 forks source link

🐛 wrong highlight with `rg --json | delta` when tabs are involved #1588

Open gennaro-tedesco opened 9 months ago

gennaro-tedesco commented 9 months ago

Duplicate of https://github.com/dandavison/delta/issues/1441 (or derivate): perhaps fixed already? My

rg --version
ripgrep 14.0.3

features:-simd-accel,+pcre2
simd(compile):+NEON
simd(runtime):+NEON

PCRE2 10.42 is available (JIT is available)

on macOS 13.6.1 Ventura.

Description

Coloured output for rg ... --json | delta fails when tabs are included in the grepped line

Example

touch file
echo $'first line\n\tsecond line\n\tthirdline' > file
rg line file

shows Screenshot 2023-12-22 at 12 44 29 whereas

rg line file --json | delta

shows Screenshot 2023-12-22 at 12 44 34 where the lines with tabs present wrong highlight.

freeformz commented 8 months ago

I have this problem too... I "solved" this by adding --tabs=1 (after trying a few different values) to my delta command line.

gennaro-tedesco commented 8 months ago

Thank you for the suggestion, it does indeed work!