[TxMt] help with workaround with known bug

Gerd Knops gerti-textmate at bitart.com
Fri May 5 04:21:05 UTC 2006


On May 4, 2006, at 21:37, Oliver Taylor wrote:

> sorry for so many messages...
>
>>> I don't speak Perl, so I was just talking generally... but each of
>>> those \t's is a tab, so maybe remove two?
>
>> Yeah, it works to remove two of the tabs, but since I also don't  
>> speak
>> Perl I can't tell why it's doing that. And that sort of bothers me,
>> that it is clearly marked as inserting two, but it actually inserts
>> four.
>
> So it works when there is text to paste in, but when it falls back to
> just positioning the cursor, only two tabs are inserted.

When TM inserts snippets it performs auto-indentation, that is what  
causes the extra tabs. And those tabs depend on the current line, so  
it will not always be two either. Unless someone knows of a way to  
disable the auto-indentation I think the easiest might be to revert  
to insert as regular text, and create a macro that calls the command  
and is followed by a search that will take care of the selection.

BTW the line with the regular expression will match more than 4 tabs  
at the beginning, and will not match if the line does not have a line  
feed at the end. This one should work better (untested):

	if(/^\t{4}(\S.*)[\r\n]*$/)

Gerd




More information about the textmate mailing list