| Summary: | Several code folding issues | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | plastiquefantastique | ||||
| Component: | cdt-editor | Assignee: | Project Inbox <cdt-editor-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Anton Leherbauer <aleherb+eclipse> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | chumak.daniel.dev, johnhenrysmith, remy.suen, yevshif | ||||
| Version: | 5.0.2 | ||||||
| Target Milestone: | 7.0 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | 178203 | ||||||
| Bug Blocks: | |||||||
| Attachments: |
|
||||||
|
Description
plastiquefantastique
Without reproducible example, I cannot do much about the issues. I'm going to try to add one or more examples in the next few days. I didn't have much time the last days, and mostly the files where this does happen consist of many hundred or thousand lines, so it's pretty difficult to find a pattern there, but I just managed to create a quick example to showcase how deleting some part inside a function can unfold other parts of the code which was initially folded. I hope to be able to single out other cases sometimes soon.
Folding Settings in Eclipse: everything checked apart from the last three options (comments, inactive preprocessor branches)
Code example (to be put into an empty new header file (*.h), the comment marks the part which should be deleted to observe the folding behaviour):
template <typename Type, typename Value>
struct Struct
{
inline Type function1()
{
// comment
switch (Value()()) // delete this switch block here
{
case 0:
break;
default:
break;
}
return Type();
}
inline Type function2()
{
// comment
return Type();
}
inline Type function3()
{
// comment
return Type();
}
inline Type function4()
{
// comment
return Type();
}
};
Thanks for the test case. Some observations: The amount of deleted text influences how much of the following text is expanded. It looks like all folded text moving into the deleted area gets expanded. JDT shows the exact same behaviour, so I believe this is a general Platform/Text issue. I'll need to debug it in detail. Re: following text There are situations where code before _and/or_ afterwards is unfolded, so while I think we are close to the issue, it seems that recalculating the folding is going wrong on a more generic level (it looks like the whole code gets recalculated on editing). Although it's certainly possible that both share the same source of the problem. Associated with Platform bug 178203. It looks like the platform bug isn't going to fixed anytime soon, so that's why I'm out of here too (moving to Netbeans finally). Thanks and good luck everyone. + 1 to plastiquefantastique@gmx.de Good luck guys, but Netbeans editor at least works without folding bugs, not talking about the other. Eclipse build id: 20100218-1602 Eclipse IDE for C/C++ Developers 1.2.2.20100209-1511 Probably this problem also belong to the bug: 1) Open few *.c files, their source code gets collapsed 2) Edit function body in file foo.c 3) Switch to file bar.c 4) Some parts of code in the file bar.c now have "horrible code layout with partly folded and unfolded parts" (In reply to comment #9) > Eclipse build id: 20100218-1602 > Eclipse IDE for C/C++ Developers 1.2.2.20100209-1511 > > Probably this problem also belong to the bug: > > 1) Open few *.c files, their source code gets collapsed > 2) Edit function body in file foo.c > 3) Switch to file bar.c > 4) Some parts of code in the file bar.c now have "horrible code layout with > partly folded and unfolded parts" 5) If I switch back to foo.c, I notice that now some parts of it also have "horrible code layout with partly folded and unfolded parts" (In reply to comment #10) > (In reply to comment #9) > > Eclipse build id: 20100218-1602 > > Eclipse IDE for C/C++ Developers 1.2.2.20100209-1511 > > > > Probably this problem also belong to the bug: > > > > 1) Open few *.c files, their source code gets collapsed > > 2) Edit function body in file foo.c > > 3) Switch to file bar.c > > 4) Some parts of code in the file bar.c now have "horrible code layout with > > partly folded and unfolded parts" > > 5) If I switch back to foo.c, I notice that now some parts of it also have > "horrible code layout with partly folded and unfolded parts" Screenshots would be helpful. Did you try with more recent builds? (In reply to comment #11) > (In reply to comment #10) > > (In reply to comment #9) > > > Eclipse build id: 20100218-1602 > > > Eclipse IDE for C/C++ Developers 1.2.2.20100209-1511 > > > > > > Probably this problem also belong to the bug: > > > > > > 1) Open few *.c files, their source code gets collapsed > > > 2) Edit function body in file foo.c > > > 3) Switch to file bar.c > > > 4) Some parts of code in the file bar.c now have "horrible code layout with > > > partly folded and unfolded parts" > > > > 5) If I switch back to foo.c, I notice that now some parts of it also have > > "horrible code layout with partly folded and unfolded parts" > > Screenshots would be helpful. > Did you try with more recent builds? Hi Anton, as the recent experience shows, the behavior I described occurs only if I enable\disable folding in between 1) - 5). And if don't and only fold\unfold than folding works as expected. Should I look for examples\screenshots for the "enable\disable folding" issue, or such behavior of enable\disable folding is expected? (In reply to comment #12) > Hi Anton, as the recent experience shows, the behavior I described occurs only > if I enable\disable folding in between 1) - 5). And if don't and only > fold\unfold than folding works as expected. > > Should I look for examples\screenshots for the "enable\disable folding" issue, > or such behavior of enable\disable folding is expected? Thanks for the clarification. When you disable/enable folding, the folding state of the editor is reset. There is no persistence of folding state, so this behavior is expected. I am marking this bug fixed since the underlying platform bug 178203 has been addressed in 3.6 which was the main reason for the complaints in comment 0. Please feel free to file new bugs as you encounter them. Created attachment 173838 [details]
Unexpected marks on layout
I've recently got such layout as attached. Everything is ok except for the unexpected(for me) "[...]" marks.
Is it expected to happen?
(In reply to comment #14) > Created an attachment (id=173838) [details] > Unexpected marks on layout > > I've recently got such layout as attached. Everything is ok except for the > unexpected(for me) "[...]" marks. > > Is it expected to happen? I see this occasionally also in the Java editor. Might be a platform bug, but without reproducible scenario, it is hard to address. (In reply to comment #15) > (In reply to comment #14) > > Created an attachment (id=173838) [details] [details] > > Unexpected marks on layout > > > > I've recently got such layout as attached. Everything is ok except for the > > unexpected(for me) "[...]" marks. > > > > Is it expected to happen? > > I see this occasionally also in the Java editor. Might be a platform bug, but > without reproducible scenario, it is hard to address. Ok, will let you (or more relative bug?) know if I am able to find a scenario in the future. |