Re: [PATCH take 3 0/4] color-words improvements
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 16, 2009, 01:37 UTC
- Message-ID
- <7vy6xcowsx.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <adf1fd3d0901151610p41930ee2gfc7259aee7e15d73@mail.gmail.com>
Santi Béjar <santi@agolina.net> writes:
Show 28 quoted lines
> It may be ok and logical, but for me it is not what I want. Mmaybe I
> don't really undestand what I want or is a crazy idea but here it is
> anyway:
>
> Take a simple case with this two lines :
>
> matrix[a,b,c]
> matrix{d,b,c}
>
> there is no space so the standard color-words does not help to
> visualize that matrix, the b and c are not changed.
>
> What I currently do is to add some spaces:
>
> matrix[ a, b, c ]
> matrix{ d, b, c }
>
> then the color-words at least says that "b, c" is unchanged.
>
> What I would like is that --color-words would act as adding this
> spaces automatically (and even one after "matrix").
>
> Or another way to think it could be:
>
> a) primary words are those with alphanumerics (or a regex)
> b) secondary "words" are the other non-whitespaces characters (in this
> case "[]{} and ,"
> c) whitespaces are cruft.Dscho and Thomas discussed and designed a way to mark "words look like this" (and anything that are not words are crufts), and Dscho further argues that it is Ok to discard crufts (which I think is fine).
What you seem to want in this example is "there is no cruft other than whitespace, but there are different kinds of words". I do not think it is incompatible with the way crufts are discarded, but it may be incompatible with the way how words are identified.
I would expect something like:
[a-zA-Z0-9]+|[^ a-zA-Z0-9]+
should define your "two kinds of words". That is, a run of alnums is a word, and a run of non-alnums is a word, but "matrix[a" is not a word (it is a sequence of three words "matrix", "[" and "a").