On Fri, May 2, 2008 at 9:59 PM, Ping Yin <pkufranky@xxxxxxxxx> wrote: > Previously --color-words only allow spaces as boundary characters. > However, just space is not enough. For example, when i rename a function > from foo to bar, following example doesn't show as expected when using > --color-words. > > ------------------ > - if (foo(arg)) > + if (bar(arg)) > ------------------ > > It shows as "if <r>(foo(arg))</r><g>(foo(arg))</g>". Actually, it's the > best to show as "if (<r>foo</r><g>bar</g>(arg))". Here "r" and "g" > represent "red" and "green" separately. > > This patch introduces a configuration diff.nonwordchars to make > --color-words treat both spaces and characters in diff.nonwordchars as > boundary characters. > > If we set diff.nonwordchars to "()", the example above will show as > "if (<r>foo(</r><g>bar(</g>arg))". It's much better, athough not the best, > Oh, there are some problems, assuming "{}" are set as diff.nonwordchars 1. Trailing boundary character lost, for example ---------------------------- $ git diff- - foo{ + foo $ git diff --color-words foo ---------------------------- With --color-words, i can't know the trailing '{' is removed. This problem exists even without my patch. In that case, only trainling spaces are lost. 2. Trailing removed words shows at new line instead of the same line ---------------------------- $ git diff - foo bar + foo (note: no space after foo) $ git diff --color-words foo <red>bar</red> -------------------------------- bar should show in the same line with bar. This is not related to my patch. -- Ping Yin -- 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