[TxMt] Linefeeds in commands & snippets

Mike Mellor alaskamike at gmail.com
Fri May 12 06:28:58 UTC 2006


I am trying to create a command that will replace text on a line with  
new text (actually modified text from the current line).  Here is the  
code that I am using:

#!/usr/bin/python
import os

def texter():
	oldtask = os.environ['TM_CURRENT_LINE']
	# oldtask = "Alligator"
	newtask = "DONE "
	for i in range (len(oldtask)):
		if i > 4:
			newtask = newtask + oldtask[i]
	print newtask	
	
texter()


The problem that I have is that it inserts a line feed at the end of  
the new text.  Is there a way to prevent that?  Thanks.

Mike



More information about the textmate mailing list