Re: [code] Python folding pretty broken

From: Carlos Pita <>
Date: Mon, 23 Feb 2015 14:10:31 -0300

> Attached is my "text outline" folder (which is actually a Lexer). It
> folds based purely on whitespace indentation.

Thank you very much. Anyway, I feel the approach
is good to have at the scintillua level, many languages would benefit
from this general strategy out of the box. Other editors, notoriously
vim, do have it in their toolboxes. It's just that blank lines
shouldn't be taken to start new top level folds. I'm not even sure
whether there should be an option for this or not, I can't figure out
a sensible use case for the current behavior. Blank lines could start
a fold at the current level (since blank lines are usually a
syntactical device to separate blocks of code internally cohesive),
but that's another story (and in this case a configuration option
could be desirable). I will take a closer look at the relevant
scintillua code later this night.


> You might want to see how it works on Python code.  I wrote it to fold
> pure text outlines, so it does not do any syntax highlighting.
> M._fold() calls
> fold_line() which calls
> walk()
> Those would be the functions I would read over first to try to
> understand what is going on.
> If you put the outline.lua file in ~/.textadept/lexers/ you should
> then be able to select it as a lexer.  I forget which menu "select
> lexer" is in.
> Unfortunately, on long files (1000+ lines), there was a noticeable
> delay when typing in new text.  This could have been due to my folder,
> or alternatively to my custom line wrapping code (which is in a
> separate file, and was also designed for my pure text outlines).  I
> never tracked down the cause of the slowness.  It could have been my
> code, Textadept, Scintilla, or some combination.
> Good luck!
> -Parke
You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Mon 23 Feb 2015 - 12:10:31 EST

This archive was generated by hypermail 2.2.0 : Tue 24 Feb 2015 - 06:43:36 EST