Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 216226 - Enhance control of code folding
Enhance control of code folding
Product: editor
Classification: Unclassified
Component: Code folding
PC Linux
: P3 (vote)
: 7.4
Assigned To: Svata Dedic
: 213218 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2012-08-01 00:13 UTC by berniev
Modified: 2013-05-02 14:14 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description berniev 2012-08-01 00:13:10 UTC
Product Version = NetBeans IDE 7.2 (Build 201207171143)
Operating System = Linux version 3.0.0-23-generic-pae running on i386
Java; VM; Vendor = 1.6.0_24
Runtime = OpenJDK Client VM 20.0-b12

FWIW ...

The code folds introduced in 7.2 are a huge leap forward. Thank you!
It would be really nice to have easier/faster access to controlling them.
Opening a document with all folds closed and then drilling down from some point in the code through several levels is a bit tedious, and one (read me) tends to do that a lot. And opening ALL folds at once is not necessarily what one wants either.

I propose to add, or move, code fold controls to the code fold symbol  ([+] or [-]) itself. This places the control right where you are looking at that time without having to find and dig through various general purpose menus, and simultaneously adding the ability to open or close all folds within a  particular starting fold.

Add right click, context sensitive, options on the code fold symbol such that:

- If fold is open (showing [-]):
	a) close current fold.
	b) close current fold AND all enclosed folds.

- If fold is closed (showing[+]):
	a) open current fold.
	b) Open current fold AND all enclosed folds.

Currently right click is unused at the code fold symbol.
Comment 1 Svata Dedic 2012-12-11 10:37:39 UTC
*** Bug 213218 has been marked as a duplicate of this bug. ***
Comment 2 Svata Dedic 2012-12-11 10:38:57 UTC
Planning for 7.4.
The recursive unfold should be possibly by both mouse gestures in the outline bar, and by popup menu actions, with the option to assign keyboard shortcuts to them.
Comment 3 Svata Dedic 2013-04-29 14:38:07 UTC
BTW - what is the scenario for "close current fold and enclosed folds" ? I understand the "expand subtree" drilldown case ... but collapse ?
Comment 4 Svata Dedic 2013-04-29 14:56:27 UTC
CTRL SHIFT [+] is already assigned to "expand all", so the next sensible shortcut would be CTRL-SHIFT-[*] (numpad star/multiply)
Comment 5 berniev 2013-04-29 15:30:31 UTC
Consistency: For each open option an equivalent collapse option. IMHO it's much easier if you don't have to remember whether a permutation is implemented or not.

If I close(all) a chunk of code, I know it will reopen in a clean, all nested folds closed state, not with some nested folds open and some closed from previous fiddling.

On the other hand if I just close a fold, I would reasonably expect that when I reopen it, the previous state of nested folds will be restored.

I have no opinion re keys, my brain only remembers the shortcut keys I use lots! Not being a nix guru I prefer to work visually using mouse for most things (suspect I am not alone), hence the proposal re the mouse actions on the code fold symbol on screen.
Comment 6 Svata Dedic 2013-04-30 11:18:42 UTC
Implemented in

The recursive collapse/expand can be achieved when holding SHIFT and clicking on the fold sign. In addition, shortcuts CTRL-Num* (expand), CTRL-Num/ (collapse), alternatively CTRL-ALT-[+], CTRL-ALT[-]. Should be CMD-ALT-[+-] on mac.
Comment 7 berniev 2013-05-02 01:31:43 UTC

I am curious though why the original suggestion to include a right-click based option was apparently not adopted. Many other options are available this way and without it this wonderful feature is rather hidden, unless you know to go looking for it.
Comment 8 Quality Engineering 2013-05-02 14:14:12 UTC
Integrated into 'main-golden', will be available in build *201305021042* on (upload may still be in progress)
User: Svata Dedic <>
Log: #216226: Implemented recursive expand/collapse, shortcuts added. Enabled for CSL-based editors

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo