Struggling with folding/collapsing

287 views
Skip to first unread message

BenJ

unread,
Nov 9, 2018, 12:40:15 PM11/9/18
to BBEdit Talk
I've struggled with this for a while, it just seems to not work how I would like it to work, so I thought I'd document my experiences here to see whether I'm just doing something wrong, or missing something, or whether it's worth formulating my experience into some kind of feature request. Maybe some helpful folks could give me some other experiences.

My biggest use for folding is collapsing PHP functions so I don't have to see that code unless I want to. Files are typically something along the lines of this:-

<?php
class Test_class
{
 
var $foo;

 
function some_function($blah)
 
{
 
// code
 
}

 
function some_other_function($ugh)
 
{
 
// more code }
 
}
?>
 


What I most want, is a simple key command to toggle open or collapse just those functions. (I'm happy to have to place the cursor on the function or brackets of that function first).

This doesn't seem to be possible in BBEdit, so I've always had to (for years!) resort to using the mouse to open and close the fold disclosure triangles in the margin. (Yes, I've read the manual on all the folding methods)

Looking at the fold commands available, we have:
- Balance & Fold

- Fold Selection
- Unfold Selection

- Collapse Enclosing Fold
- Collapse Top-Level Folds
- Collapse All Folds
- Collapse Folds below level -> 1, 2
- Expand All Folds

None of these commands replicate the action of just clicking on the disclosure/fold arrow, which opens/collapses *just* that fold, without changing the fold status of anything inside, or outside that fold.

The closest I can get is to place the cursor on one of the function brackets, and do a "Balance & Fold " keyboard shortcut. This folds the desired function, without affecting any folds inside. It does leave the fold selected, which is a bit annoying, but not a huge deal. There is no key equivalent I can see to open this fold - the closest I can get is to have to select the fold first, and then do "Unfold Selection".

(All of the other collapse commands collapse *all folds below certain levels, which is not the behaviour I want either).

So, I just want to be able to, with one key, duplicate the action of opening/collapsing the disclosure triangle on that line. Hopefully some kind soul can show me that I've missed something ridiculously simple and it's possible in the straightforward way I'd most like it work - place cursor, hit shortcut to collapse or open just that fold.

Hope this makes sense, 
Thanks,
Ben

BenJ

unread,
Nov 9, 2018, 5:44:57 PM11/9/18
to BBEdit Talk
Well, I submitted a FR anyway, they seemed to think the idea had merit, so hopefully this might get improved at some point.
Reply all
Reply to author
Forward
0 new messages