Re: Folding menu functions and/or hotkeys?

From: mitchell <>
Date: Sat, 27 Mar 2010 17:46:11 -0700 (PDT)


> 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

expand_folds() would be the same except 'if not fold_expanded ...'


> Regards,
> Russell Dickenson
Received on Sat 27 Mar 2010 - 20:46:11 EDT

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