[TxMt] Double-byte spaces not distinguishable

Hans-Joerg Bibiko bibiko at eva.mpg.de
Thu Sep 27 12:40:20 UTC 2007


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.

ja mata,

Hans







More information about the textmate mailing list