[TxMt] Double-byte spaces not distinguishable
Takaaki Kato
devlist at samuraicoder.net
Sat Sep 29 06:56:18 UTC 2007
On Sep 27, 2007, at 9:40 PM, Hans-Joerg Bibiko wrote:
>
> On 27 Sep 2007, at 14:10, Takaaki Kato wrote:
>> Is there a way to find or colorize double-byte space that in the
>> document? I've been using a double-byle language, called Japanese
>> with TextMate. The problem I encounter every now and then is to
>> mistakenly type double-byte spaces where they, as they are treated
>> as strings, are now allowed.
>>
>> At this time, there's no way to distinguish double-byte spaces and
>> single-byte spaces in the document window.
>>
>> I guess there would be a way to find the space by grep and
>> highlight it adding scope in language grammars. Right? Anybody?
>>
>
> Well, there are several ways to handle this.
> The easiest would be to replace all ' ' with ' ' before save
> the file or do something with the file.
>
> If you want to see these double byte space you can add this in a
> language grammar under 'patterns':
>
> { match = '[^ ]*( )[^ ]*';
> captures = { 1 = { name = 'meta.character.DBSpace'; }; };
> },
>
>
> and finally you can add an element within TM's preferences > Fonts
> & Colors called 'DBSpace' with the scope selector
> 'meta.character.DBSpace' and set the background color (BG) to what
> ever you like.
>
> The next idea would be to create a snippet with a single ASCII
> SPACE and bind it to a key equivalent SPACE.
>
Thanks Hans,
The highlighting works. I'm pretty surprised to see the simple grep
matching. I was expecing some difficult grep to grab the spaces.
I'm not supresseing every double-byte spaces because double-byte
spaces should be allowed in Japanese strings.
Takaaki
--
Takaaki Kato
http://samuraicoder.net
More information about the textmate
mailing list