Re: Folding Wiki Article Update

From: Jay <robert.jay.go....at.gmail.com>
Date: Thu, 3 Jun 2010 04:40:52 -0700 (PDT)

Haven't tried your fix yet, but I wrote the original script. If your
patch works, please feel free to update the wiki

-Jay

On Jun 3, 12:17 am, Ryan Pusztai <rpusz....at.gmail.com> wrote:
> Hi All,
>
> Not sure where to post this or if I should just fix it...
>
> I tried out the 'Folding Commands' wiki article (http://caladbolg.net/textadeptwiki/index.php?n=Main.Foldingcommands) and
> found that the current "collapse_fold()" function was moving the cursor to
> the top of the file if you collapse a function that was at the same level as
> the root of the file.
>
> Here is a small patch that works a bit better about moving the cursor to the
> correct parent.
>
> function collapse_fold(line)
>  local line = line or buffer:line_from_position(buffer.current_pos)
> if buffer.fold_expanded[line] and buffer.line_visible[line] then
>  buffer:toggle_fold(line) -- colapse fold
> if not buffer.line_visible[line] then
>  buffer:goto_line(buffer.fold_parent[line]) --set caret on parent fold line
> end
>  end
> end
>
> Should I just make the change? Did I forget a situation this won't work in.
> Thoughts?
> --
> Regards,
Received on Thu 03 Jun 2010 - 07:40:52 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:46:48 EST