So the total change is pretty large, I have to admit. But at least _I_ think it is easy to follow, and it actually makes the code more readable/hackable. Correct me if I'm wrong. The basic idea is to decouple the original text from the text that is passed to libxdiff to find the word differences. To that end, the words of the pre and post texts are put into two lists that are fed to libxdiff. While the words are extracted, an array is created which contains pointers back to the word boundaries in the original text. To make the transition as easy to understand as possible, the code is first refactored without actually changing what makes a word boundary. Johannes Schindelin (4): Add color_fwrite(), a function coloring each line individually color-words: refactor word splitting and use ALLOC_GROW() color-words: refactor to allow for 0-character word boundaries color-words: take an optional regular expression describing words color.c | 24 ++++++++ color.h | 1 + diff.c | 185 +++++++++++++++++++++++++++++++++++++++------------------------ diff.h | 1 + 4 files changed, 141 insertions(+), 70 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html