Folding Wiki Article Update

From: Ryan Pusztai <rpusz....at.gmail.com>
Date: Wed, 2 Jun 2010 11:17:59 -0400

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,
Ryan
Received on Wed 02 Jun 2010 - 11:17:59 EDT

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