daff icon indicating copy to clipboard operation
daff copied to clipboard

Show row number or fixed column in diff

Open watho opened this issue 2 years ago • 4 comments

Hi,

is it possible to always show a column in the diff? I am comparing excel sheets with 10.000 rows and more and need the line number for context. Otherwise it is impossible to know where the difference inside the sheet is.

watho avatar Mar 04 '22 13:03 watho

Do you have a lot of columns @watho? If not too many --all-columns might be adequate - it will turn off pruning of unchanged columns.

paulfitz avatar Mar 04 '22 15:03 paulfitz

Yes, over 50. That's not an option.

Thx for the quick answer.

watho avatar Mar 04 '22 15:03 watho

Hmm it has been a while since I looked at this, but I'd have expected the leftmost columns to be shown by default. Is line number an explicit column in your diff? If not, the --index flag may be what you are looking for, it makes the row and column mappings explicit, and the row mappings include corresponding row numbers in the two tables:

$ daff --index data.csv data2.csv
@:@,   ,A:A,B:B,...,I:I,J:J
   ,@@ ,a  ,b  ,...,i  ,j
   ,...,...,...,...,...,...
2:2,   ,101,2  ,...,9  ,10
3:3,→  ,103,2  ,...,9  ,10→100

paulfitz avatar Mar 04 '22 16:03 paulfitz

Somehow i missed this option and created my own rownumber column. Looking at the code the --index flag correspondents to the flag always_show_order on CompareFlags, right? I will try this.

watho avatar Mar 04 '22 16:03 watho