[TxMt] Insert Color Revised (help needed)

Brett Terpstra brett at circlesixdesign.com
Sat Oct 21 11:04:05 UTC 2006


On Oct 21, 2006, at 12:19 AM, Charilaos Skiadas wrote:

> On Oct 20, 2006, at 10:42 PM, Brett Terpstra wrote:
>
>> It works, but I'd really like to see it cleaned up (I know Haris  
>> could do this in about 4 lines of code).  So if anyone has the  
>> time... It'd be great to learn a new algorithm to handle this.
>
> Well, since you asked for it ;) I'm sure JEG2 can shorten this  
> further, but here is my take on it. I've attached the command, and  
> appended the actual code.

Thank you, that is spectacular.  This is what really had me stumped:

string = $1 * 2 + $2 * 2 + $3 * 2 if string =~ /^(.)(.)(.)$/

You do hate intermediate variables, don't you ;-)?  Anyway, thanks  
for your time, now it's ready for prime time.

> Perhaps we should add this to the CSS bundle?

I second the motion.  As I mentioned before, the included command is  
in conflict with almost all of the snippets in the CSS bundle, which  
insert #DDD as the tab stop and only highlight the DDD.  If you run  
the default Insert Color command and choose white at that point  
you'll end up with ##FFFFFF.  I strongly recommend that this be  
modified!

> Haris

Thanks,
Brett




More information about the textmate mailing list