difftastic icon indicating copy to clipboard operation
difftastic copied to clipboard

[RFE] display whitespace changes

Open martinetd opened this issue 2 years ago • 1 comments

First, thanks for making this!

Playing around with difftastic, I noticed that in textual mode the last line of a file being appended to is being marked as different:

$ difft --version
Difftastic 0.24.0
$ difft <(echo -ne 'one\ntwo\nthree\n') <(echo -ne 'one\ntwo\nthree\nfour\n')
/dev/fd/62 --- 1/1 --- Text
1 one                                   1 one                                   
2 two                                   2 two                                   
3 three                                 3 three                                 
                                        4 four                                  

(here, three is red/green) Playing further with it, adding spaces at end of lines is just not displayed aside of coloring the line, leaving one to wonder why the line was marked modified. Missing last end of line also does not show anything -- it might make sense for syntactic changes when it understands a file but I believe text files should display these, stuff like e.g. markdown behaves differently when there are trailing spaces. (in particular git default diff command shows these in red and it helps when reviewing code being added with e.g. git add -p. That command doesn't use external diff tool so I'd still see it then, but not when inspecting changes before or when adding in larger batches)

For programs it understand, e.g. trying with C files a line with added spaces isn't even marked as modified -- it's all blank. "No synatic change" if there's nothing else, and not highlighted at all if there's other changes. It's correct, but I'd like an option to display these if possible -- think git diff --ignore-all-space opposite.

I don't think I'll be ready to replace the default diff until I can display whitespaces reliably, but I'll definitely keep it around as difftool. cheers!

martinetd avatar Mar 29 '22 18:03 martinetd

Hi! Thanks for this project, it looks great!

I share @martinetd opinion: I would like to difftastic for my daily git diffs and the main feature that is missing for me is the possibility to force the highlighting of whitespace changes.

mpoquet avatar Feb 05 '24 15:02 mpoquet