This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 201270 - Code folding marks are not redrawn correctly after expanding folds
Summary: Code folding marks are not redrawn correctly after expanding folds
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Code folding (show other bugs)
Version: 7.1
Hardware: PC Windows XP
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
: 116063 195310 197693 201411 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-08-24 08:45 UTC by Vladimir Riha
Modified: 2012-02-03 11:53 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot (17.72 KB, image/png)
2011-08-24 08:45 UTC, Vladimir Riha
Details
second screenshot (90.81 KB, image/png)
2011-09-12 06:29 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2011-08-24 08:45:59 UTC
Created attachment 110177 [details]
screenshot

Look at the screenshot, all I did was collapsing all folds and expanding them again several times. This happens a lot, I was able to reproduce it several times with php and java files.

Could be related to issue #196281 but it looks a little different

Product Version: NetBeans IDE Dev (Build 201108210601)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 1 Svata Dedic 2011-09-08 12:32:43 UTC
I need a reliable testcase. I played with the feature for a while, on various sources (Java, JSP, PHP, XML) and saw the effect once, but with no reliable reproduction.

Ideally, attach a source + steps to reach the erroneous state starting from file open; also try if a certain editor window size does not contribute to the problem appearing.

Marking as P3, since the bug seem to happen rather infrequently.
Comment 2 Vladimir Riha 2011-09-12 06:29:12 UTC
Have you tried WinXP? I don't have problem reproducing this on them. The most detailed steps I just did to reproduce:
- start dev build (201109110600)
- create new PHP project
- fold/unfold several times by clicking on first folding mark at line 2 and the result looks like in the first screenshot.

If I repeat the same with last fold, check the new screenshot to see what happened.
Comment 3 Vladimir Riha 2011-09-12 06:29:41 UTC
Created attachment 110639 [details]
second screenshot
Comment 4 Svata Dedic 2011-09-12 09:59:13 UTC
Could you please check, in the invalid state like on screenshot #1, whether switching away from NB then back (which repaints the editor area) will display the folding correctly ?
Comment 5 Vladimir Riha 2011-09-12 10:38:07 UTC
Yes, that does help, all folds are displayed correctly
Comment 6 Svata Dedic 2011-09-12 12:09:21 UTC
Found the root cause.
The sidebar schedules repaint() when it receives FolderHiearchy event; at the same time the FoldViewFactory invalidates a region of views and schedules rebuild. SOMETIMES the repaint event is processed just before the views are recreated, so sidebar works with obsolete XY positions and view hierarchy which still records folded views.

Possible solution: wait for the view hierarchy to fully update - Mila is implementing a listener for that (I will wait for it).

Another possible race which should be prevented is an additional FH event in a freshly build view hierarchy (a new rebuild will be scheduled). Sidebar should not update in this case, since fold data vs. view data is not consistent at the moment.
Comment 7 Miloslav Metelka 2011-09-18 20:51:42 UTC
Svato, I've just finished issue #202273. So as we've talked you could now listen on ViewHierarchyListener in o.n.m.lib2.view and check if ViewHierarchyEvent.isChangeY() returns true and if so then repaint the folding side bar. Thanks.
Comment 8 Quality Engineering 2011-09-21 08:12:36 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/f6343d1bac5a
User: sdedic@netbeans.org
Log: #201270: sidebar repainted afer view hierarchy recomputes
Comment 9 Miloslav Metelka 2011-09-21 14:30:00 UTC
*** Bug 201411 has been marked as a duplicate of this bug. ***
Comment 10 Vladimir Riha 2011-09-22 11:27:39 UTC
verfied

NetBeans IDE Dev (Build 201109220601)
Comment 11 Svata Dedic 2011-09-29 08:32:29 UTC
*** Bug 201921 has been marked as a duplicate of this bug. ***
Comment 12 Svata Dedic 2011-09-30 14:26:15 UTC
*** Bug 197693 has been marked as a duplicate of this bug. ***
Comment 13 Svata Dedic 2011-09-30 14:26:43 UTC
*** Bug 195310 has been marked as a duplicate of this bug. ***
Comment 14 Svata Dedic 2012-02-03 11:53:58 UTC
*** Bug 116063 has been marked as a duplicate of this bug. ***