Re: Folding menu functions and/or hotkeys?

From: phayz <russelldicken....at.gmail.com>
Date: Sun, 28 Mar 2010 04:33:32 -0700 (PDT)

On Mar 28, 10:46 am, mitchell <mforal.n....at.gmail.com> wrote:
> Hi,
>
> > I know that Textadept supports folding in that it will display folding
> > points in the margin. However if I want to fold all folding points, or
> > perhaps unfold them all, I can't find an appropriate menu option. Of
> > course Textadept's menu is fully customisable and technically I have
> > the ability to create such a menu. With previous entries to this group
> > however, I have proven that I don't have a clue what I am doing when
> > trying to customise Textadept.
>
> > Can someone give me some hints as to how I might do this? Or is this a
> > function that should not be added to Textadept?
>
> You can write a lua function to iterate over all buffer lines, check
> the fold state, and perform a toggle_fold as necessary.
>
> function collapse_folds()
>   for i = 0, buffer.line_count - 1 do
>     if buffer.fold_expanded[i] and buffer.line_visible[i] then
> buffer:toggle_fold(i) end
>   end
> end
>
> expand_folds() would be the same except 'if not fold_expanded ...'
>
> Mitchell

Mitchell and Robert,

I will try your suggestions as soon as I can and report the results
here. I want to use a "fold all folding points" and "unfold all
folding points" mainly so that I can use Textadpet as an outliner. I'm
hoping to indent various sections of text and have Textadept fold
according to the level of indentation.

Regards,

Russell Dickenson
Received on Sun 28 Mar 2010 - 07:33:32 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:41:03 EST