Closed snoopy closed 8 months ago
Hi @snoopy, try something like word-diff-regex = .
. delta first tokenizes the input by "word", and then diffs the token stream. word-diff-regex
is the tokenization regex defining what a "word" is.
--word-diff-regex <REGEX>
Regular expression defining a 'word' in within-line diff algorithm.
The regular expression used to decide what a word is for the within-line highlight algorithm. For less fine-grained matching than the default try --word-diff-regex="\S+" --max-line-distance=1.0 (this is m
ore similar to `git --word-diff`).
[default: \w+]
delta doesn't provide an emulation of diff-highlight's word diff algorithm, but I've always thought it would be interesting/useful to add it. If anyone wanted to add a word-diff-algorithm
flag to delta allowing user's to choose between delta's current algorithm, and a Rust implementation of diff-highlight's (simple) algorithm, etc, I think that could be good.
I'm trying delta as a replacement for diff-highlight but there seems to be a difference in how certain changes are highlighted. I can't reproduce this behavior in delta.
In this image the delta diff output is shown on the top and diff-highlight on the bottom.![diff](https://github.com/dandavison/delta/assets/37296322/55fcc4ea-cc02-4101-8ac6-43052f15580c)
Note how diff-highlight correctly highlights the change while delta does not. This happens regardless of using
--diff-highlight
. I also tried changing the value ofmax-line-distance
but to no avail.Is this just a user error or actually a bug?