[TxMt] [ANN] Select Balanced HTML Tag!!!1!

Thomas Aylott - subtleGradient textmate at subtleGradient.com
Fri Nov 16 11:23:49 UTC 2007


Thanks!

Yeah, I've already come across most of this stuff too.
I just finally found something that half-worked and wanted to get it  
out in the world before I got bored or too busy to finish it.

Some sort of native functionality is what I would prefer.
	It's almost shameful that TextMate doesn't offer this natively.

For the updated version, I'll probly have it escape all brackets in  
the doc first, and then do another pass to put back only those  
brackets that are most likely to give the best balancing results. And  
then do all the business with selections and whatever. That should  
make it much more robust and capable of handling rhtml and embedded  
source and stuff.

The current version is only really useful on REALLY clean pages, and  
then only sometimes ;)

I'd also like to build up some nice testcases to check against anytime  
I make any changes.
	I bet I could use TMTOOLS to automate testing since it can move the  
caret around and run macros.

—Thomas Aylott – subtleGradient—


On Nov 16, 2007, at 5:41 AM, Hans-Jörg Bibiko wrote:

> On 15.11.2007, at 19:50, Saul Rosenbaum wrote:
>> rock on! -- that's great...
> First of all: yes, I agree, it's an awesome macro ;)
>
> But I encounter further tiny problems.
>
> 1)
> I'd prefer to not use the local clipboard for that macro
>
> 2)
> The macro doesn't work for such an HTML:
>
>
> <html>
> <head>
> 	<title>title</title>
> 	<style type="text/css" media="screen">
> 	p {
> 	    color: red;
> 	}
> 	</style>
> </head>
> <body>
> <p>Test <i>bla</i>sak{j}d(sahdskjdh)sadasl
> sakd</p>
> </body></html>
>
>
> If you delete <title>..</title> it works
> If you leave <title> and delete <style> instead it also works
> BTW: I don't know why.
>
> 3)
> If you place the caret inside of '()' or '{}' it matches these  
> brackets first. No problem redo it.
>
> 4)
> To use the undo function for going back it's awesome too, but it  
> could be a bit confusing if one wants to really undo something. One  
> has to do it at east twice.
>
> 5)
> Sometimes the entire window is scrolled to right side after  
> selecting. This is maybe an issue of the length of some lines if one  
> has switch off 'soft wrap'.
>
> 6)
> Instead of using CARET_WAS_HERE and ≤, ≥ I'd prefer to use unused  
> unicode code points like \UFFFF0 -\UFFF9
>
>
>
> By myself I also tried it with TMTOOLS. In principal it works, it's  
> also faster, but there are other tiny things.
>
> On the other hand TM has that selectBlock: function built-in. I  
> don't know whether it would be possible for Allan to modify that  
> function in order to get rid of it, because this feature is actually  
> a very essential one, by my opinion.
>
>
> Nevertheless, it's a very cool approach ;)
>
> Cheers,
>
> --Hans
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list