Re: [code] Recursive fold_all

From: Mitchell <m.att.foicica.com>
Date: Tue, 3 Mar 2015 16:09:52 -0500 (EST)

Hi Carlos,

On Tue, 3 Mar 2015, Carlos Pita wrote:

> Hi all,
>
> Not sure whether this is intended or not. Say I do a fold_all contract
> in a buffer with a structure like this:
>
> fold_1:
> fold_11:
> ....
> fold_12:
> ....
>
> I get:
>
> +fold_1...
>
> which is fine. Now if I press C-* over the fold, I get:
>
> fold_1:
> fold_11:
> ....
> fold_12:
> ....
>
>
> again (that is, all subfolds expanded). But if I manually toggle
> fold_11, fold_12 and fold_1, in that order, using C-*, so that I get:
>
> +fold_1...
>
> as before, now pressing C-* over the fold returns:
>
> fold_1:
> +fold_11...
> +fold_12...
>
> I would like to use fold_all in order to get an outline of the buffer
> and then selectively unfold the branch of the tree I'm interested in.
> But fold_all seems not to fold recursively but just the top level.
>
> Is this intended? Am I doing something wrong?

After looking at Scintilla's source, the behavior you describe looks
intentional: fold_all collapse doesn't fold recursively, just all folds
with the level of the current line. If you want to collapse every fold,
you'll have to iterate over all lines, and then call fold_children
collapse on top-level folds (fold headers with a fold level of 0). This
may help[1], but I can't tell right away if it does exactly what you want.

Cheers,
Mitchell

[1]: http://sourceforge.net/p/scintilla/scite/ci/default/tree/src/SciTEBase.cxx#l3669

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Tue 03 Mar 2015 - 16:09:52 EST

This archive was generated by hypermail 2.2.0 : Wed 04 Mar 2015 - 06:46:20 EST