[TxMt] Serious bug with Python syntax highlighting

Rob Shearer textmate at v.cx
Tue Feb 6 12:34:28 UTC 2007


Ticket is http://macromates.com/ticket/show?ticket_id=CFB2B0B7
The note tells you how to update the bundle.

My own trivial example (that I put together before I found that  
ticket) was to open a new file, set its language to Python, and then  
type a[0]b[]. TM will hang before you finish.

-rob

On 6 Feb 2007, at 11:16, Nicolas Weber wrote:

> Hi,
>
> I've stumbled on a problem with TextMate's python handling which  
> goes into an infinite loop (or a really long computation) during  
> certain circumstances. When this happens, TextMate doesn't react to  
> any input anymore, which causes dataloss of everything typed after  
> the last save.
>
> I have the following function (<> only shows the position of the  
> caret and is no text) in a python file:
>
> def c(docstring, baseindent=0):
>   #from http://www.python.org/dev/peps/pep-0257/
>   lines = docstring.splitlines()
>   # Determine minimum indentation (first line doesn't count):
>   indent = sys.maxint
>   for line in lines[1:]:
>     stripped = line.lstrip()
>     if stripped:
>       indent = min(indent, len(line) - len(stripped))
>   # Remove indentation (first line is special):
>   trimmed = [<>lines[0].strip()]
>   if indent < sys.maxint:
>     indent -= baseindent
>     for line in lines[1:]:
>       trimmed.append(line[indent:].rstrip())
>   # Return a single string:
>   return '\n'.join(trimmed)
>
> Now I type ]<enter> and watch TextMate die. It'd be cool if this  
> could be fixed.
>
> To reproduce the problem:
> 1. Open TextMate
> 2. Paste the above function into TextMate, put your caret where <>  
> is (and remove <> from the text)
> 3. Go into python mode (shift-ctrl-opt-p 4)
> 4. enter ]<cr>
>
>
> Bye,
> Nico
>
> ______________________________________________________________________
> 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