[TxMt] help with workaround with known bug

Gerd Knops gerti-textmate at bitart.com
Thu May 4 22:45:00 UTC 2006


On May 4, 2006, at 3:00 PM, Oliver Taylor wrote:

> Allan recently isolated a bug I found to be in the regular expression
> library TextMate uses and we're waiting for a response. While we wait
> I was looking to implement the feature that crashed TextMate and I
> hoped you all could help me out with some ruby or perl (or whatever)
> voodoo.
>
> The bug is explained here: http://ollieman.net/videos/find-bug.mov
>
> The expected behavior is explained here: http://ollieman.net/videos/ 
> desired.mp4
>
> It works the rest of the time, it's just when at the beginning of the
> document that it crashes.
>
> Thanks in advance for any help.

If I understand the problem correct, the script below does that.  
Input set to 'Entire Document', Output to 'Insert as Text'.

Gerd


#!/usr/bin/perl -w
$m1=$m2='';
$c=1;
while(<>)
{
	if(/^\t{4}(.+)[\r\n]+$/)
	{
		$m1=$m2;
		$m2=$1;
	}
	$c++;
	last if($c==$ENV{'TM_LINE_NUMBER'});
}
print "\n\n\t\t\t\t$m1";




More information about the textmate mailing list