Johannes Schindelin wrote: > BTW I did not really think about the issue you raised about the newlines, > as I seemed to remember that the idea was to substitute all non-word > characters with newlines, so that the offsets in the substituted text are > the same as in the original text. Ok, so here's a very simple example: Suppose you have the word regex 'x+|y+' and compare these two lines: A: xxyyxy B: xyxyy There are *no* non-word characters between consecutive words in this case, so you *cannot* replace them with newlines. You cannot replace some word character either, as should be obvious from the case of one-letter words, as you would lose actual content. My counterexample to your illustration patch exploited a similar border case: suppose you decide to overwrite the first (instead of last) character of each word, then you won't be able to tell "foo" from "\noo" in the input. Unfortunately the space adjustement makes things even worse. The existing method has the side-effect that it only inserts a single newline between words separated by exactly one space, which runs them together in the resulting line diff, for example A: foo bar B: baz quux would result in -foo -bar +baz +quux instead of (as my original attempts did) the arguably more correct, but less readable -foo +bar -baz +quux where the middle line is a context line for the space. So in addition to the word-ending adjustments for the inserted newlines, I also have to track the status of the space right after the word. > So I still find your patch way too large I can't think of a simpler way to do it, and yours unfortunately doesn't work. -- Thomas Rast trast@{inf,student}.ethz.ch
Attachment:
signature.asc
Description: This is a digitally signed message part.