dandavison / delta

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

🐛 ripgrep match highlight positions incorrect when tabs are present #1501

Closed dandavison closed 1 year ago

dandavison commented 1 year ago

E.g.

git clone https://github.com/temporalio/temporal
cd temporal
rg --json string common/xdc/ndc_history_resender.go
{"type":"begin","data":{"path":{"text":"common/xdc/ndc_history_resender.go"}}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\t\t\tremoteClusterName string,\n"},"line_number":62,"absolute_offset":2477,"submatches":[{"match":{"text":"string"},"start":21,"end":27}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\t\t\tworkflowID string,\n"},"line_number":64,"absolute_offset":2535,"submatches":[{"match":{"text":"string"},"start":14,"end":20}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\t\t\trunID string,\n"},"line_number":65,"absolute_offset":2557,"submatches":[{"match":{"text":"string"},"start":9,"end":15}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\tremoteClusterName string,\n"},"line_number":116,"absolute_offset":4025,"submatches":[{"match":{"text":"string"},"start":19,"end":25}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\tworkflowID string,\n"},"line_number":118,"absolute_offset":4079,"submatches":[{"match":{"text":"string"},"start":12,"end":18}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\trunID string,\n"},"line_number":119,"absolute_offset":4099,"submatches":[{"match":{"text":"string"},"start":7,"end":13}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\tremoteClusterName string,\n"},"line_number":182,"absolute_offset":5611,"submatches":[{"match":{"text":"string"},"start":19,"end":25}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\tworkflowID string,\n"},"line_number":184,"absolute_offset":5665,"submatches":[{"match":{"text":"string"},"start":12,"end":18}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\trunID string,\n"},"line_number":185,"absolute_offset":5685,"submatches":[{"match":{"text":"string"},"start":7,"end":13}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\tworkflowID string,\n"},"line_number":226,"absolute_offset":6629,"submatches":[{"match":{"text":"string"},"start":12,"end":18}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\trunID string,\n"},"line_number":227,"absolute_offset":6649,"submatches":[{"match":{"text":"string"},"start":7,"end":13}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\tremoteClusterName string,\n"},"line_number":256,"absolute_offset":7433,"submatches":[{"match":{"text":"string"},"start":19,"end":25}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\tworkflowID string,\n"},"line_number":258,"absolute_offset":7487,"submatches":[{"match":{"text":"string"},"start":12,"end":18}]}}
{"type":"match","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"lines":{"text":"\trunID string,\n"},"line_number":259,"absolute_offset":7507,"submatches":[{"match":{"text":"string"},"start":7,"end":13}]}}
{"type":"end","data":{"path":{"text":"common/xdc/ndc_history_resender.go"},"binary_offset":null,"stats":{"elapsed":{"secs":0,"nanos":33416,"human":"0.000033s"},"searches":1,"searches_with_match":1,"bytes_searched":8580,"bytes_printed":3236,"matched_lines":14,"matches":14}}}
{"data":{"elapsed_total":{"human":"0.000747s","nanos":746708,"secs":0},"stats":{"bytes_printed":3236,"bytes_searched":8580,"elapsed":{"human":"0.000033s","nanos":33416,"secs":0},"matched_lines":14,"matches":14,"searches":1,"searches_with_match":1}},"type":"summary"}
rg --json string common/xdc/ndc_history_resender.go | delta
image
dandavison commented 1 year ago

@ippsav any interest in this one? This is a pretty bad bug!

ippsav commented 1 year ago

@dandavison sorry, I didn't get the notification !