On Fri, Sep 26, 2008 at 4:35 PM, Bram Moolenaar wrote:
> Justin DeVuyst wrote:
>> Sorry for the vagueness.  I'm talking about the "Changed text
>> inside a Changed line" as the vim docs say.  AKA the portion of
>> a diff that's shown using the DiffText highlight group.  In fact,
>> the docs describe better what I said in my original post:
>>
>> Vim finds the first character that is different,
>> and the last character that is different
>> (searching from the end of the line).  The
>> text in between is highlighted.  This means
>> that parts in the middle that are still the
>> same are highlighted anyway.
>>
>> I'm proposing that this part of the diff go further and show
>> all the changes by at least unhighlighting the characters
>> that are not different if not going farther.  In effect a
>> more granular and accurate diff at the character level.
>
> If you think about it, you find that it is very difficult to define what
> "changed" means.  Diff normally has delete, insert and change operators.
> Applying that to a line of characters you can make a change in an
> unlimited number of ways.  Some define the optimal way to be the one
> that has the lowest number of operators, but that often leads to a weird
> display.  E.g., when comparing "one two three four" with "one three two
> four", what should be highlighted?  Perhaps "wo three" and "hree two",
> because that's the changed part of the text.  Or "two" in both lines, as
> it's deleted and inserted.  Or delete "wo t" and insert "hree t"?

wdiff handles that this way:
one [-two-] three {+two+} four

Indeed, a wordwise diff in the vim sense of "word" would be very nice to have.

> Someone has mentioned a diff implementation for lines that is small
> enough it could be included in Vim.  Perhaps it also works for a line
> diff.

Unfortunately, wdiff is GPL licensed, so despite only being about 1000
lines, we can't include it in vim, even if we do include a diff
algorithm.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui