Re: [PATCH] Make words boundary for --color-words configurable
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 2, 2008, 07:45 UTC
- Message-ID
- <alpine.DEB.1.00.0805020839200.2691@eeepc-johanness>
- In-Reply-To
- <1209699564-2800-1-git-send-email-pkufranky@gmail.com>
Hi,
On Fri, 2 May 2008, Ping Yin wrote:
> Previously --color-words only allow spaces as words boundary. 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.
Thanks for starting this.
However, as Junio pointed out, it is easier to specify word-characters, rather than non-word characters (think TAB), and...
> +static int iswordsboundary(char c)
> +{
> + return isspace(c) || !!strchr(diff_words_boundary, c);
> +}this will be called quite some times. So it would make more sense to have an "unsigned char word_characters[256]" and set those entries to 1 that are to be interpreted as word characters.
This would allow you also to interpret "0-9A-Za-z" correctly.
Oh, and maybe having "::default" and "::alnum" suffixes interpreted, so that I can say "_::alnum" to have C identifiers interpreted as words?
Thanks, Dscho