Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 178203 - [projection] Eclipse is too eager to unfold code
Summary: [projection] Eclipse is too eager to unfold code
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.2.1   Edit
Hardware: All All
: P3 minor with 1 vote (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Anton Leherbauer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 128365 275425 (view as bug list)
Depends on:
Blocks: 271937
  Show dependency tree
 
Reported: 2007-03-20 05:16 EDT by Bogdan Butnaru CLA
Modified: 2010-03-15 05:14 EDT (History)
8 users (show)

See Also:
daniel_megert: review+


Attachments
Suggested fix (1.79 KB, patch)
2010-01-22 07:28 EST, Anton Leherbauer CLA
daniel_megert: iplog+
daniel_megert: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bogdan Butnaru CLA 2007-03-20 05:16:44 EDT
Build ID: M20060921-0945 (Ubuntu version: 3.2.1-2ubuntu1; updated recently through Eclipse's internal plug-in update feature.) 

Steps To Reproduce:
1. Set up Eclipse to automatically fold everything when opening a Java file.
2. Pick a Java source file, one with several methods and comments. Open the file. Notice that the folding offers a nice compact overview of the class (good thing).
3. Cut to the clipboard one of the folded methods, together with its folded comment, from the middle of the class. Make sure there's folded code right after it. Notice how a few of the following folds have unfolded (BAD thing, especially in the case of a big method with big comments).
4. Paste the method in the clipboard in another place. Sometimes this causes unfolding of adjacent code. Always unfolds the pasted method. (Bad thing, though not very grave).

More information:
That's it. The big issue is unnecessary unfolding of code near a modification (e.g. cut a block of text that doesn't change the folded sub-trees). Keeping code folded between a cut and paste is less important.
Comment 1 Dani Megert CLA 2009-05-08 04:04:02 EDT
*** Bug 275425 has been marked as a duplicate of this bug. ***
Comment 2 plastiquefantastique CLA 2009-05-23 10:00:01 EDT
Any news on this item ?
Comment 3 Dani Megert CLA 2009-05-25 03:02:46 EDT
>Any news on this item ?
No plans to work on this.
Comment 4 plastiquefantastique CLA 2009-05-25 10:04:25 EDT
Thanks for the honest reply. In the meantime I'm already in the middle of moving everything to Netbeans, as I can't take the Eclipse editor bugs anymore. The feature set is different but it at least works. Good luck for future development.
Comment 5 John Smith CLA 2010-01-22 05:05:07 EST
+ 1 to plastiquefantastique@gmx.de

Good luck guys, but Netbeans editor at least works without folding bugs, not talking about the other.
Comment 6 Anton Leherbauer CLA 2010-01-22 07:28:57 EST
Created attachment 156923 [details]
Suggested fix

Thanks for the friendly reminder.

Here is a patch to fix this issue.
Instead of expanding all projections in the deleted range, only the projections of the replacement text range are expanded.  I also verified that the fix for bug 84983 still works.
Comment 7 John Smith CLA 2010-01-26 03:44:55 EST
(In reply to comment #6)
> Thanks for the friendly reminder.
> Here is a patch to fix this issue.

Thanks Anton, it would really be nice to see this implemented as it is almost impossible to work with the current folding behavior.
Comment 8 Dani Megert CLA 2010-02-23 10:48:50 EST
Thanks Anton!

Committed to HEAD.
Available in builds >= N20100223-2000.
Comment 9 Dani Megert CLA 2010-02-23 10:52:38 EST
FYI: I've changed the copyright notice to:
Anton Leherbauer <anton.leherbauer@windriver.com> - [projection] Eclipse is too eager to unfold code - http://bugs.eclipse.org/178203
Comment 10 Dani Megert CLA 2010-02-23 10:52:44 EST
*** Bug 128365 has been marked as a duplicate of this bug. ***
Comment 11 Deepak Azad CLA 2010-03-09 04:04:46 EST
- Select one or more folded method
- Hit Ctrl+X or Edit -> Cut
=> The selected methods are expanded, I have to select the unfolded methods and cut again (bad thing). However other folded methods are left as it is. Is this expected behavior?

Tested with I20100308-1300.
Comment 12 Dani Megert CLA 2010-03-15 05:14:22 EDT
>- Hit Ctrl+X or Edit -> Cut
>=> The selected methods are expanded, I have to select the unfolded methods and
>cut again (bad thing).
This is due to bug 75222.

>However other folded methods are left as it is.
That's what this bug was about - marking as verified.