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 270172

Summary: Editor scrolls to the wrong place when navigating to a line in a newly opened file
Product: editor Reporter: SirIntellegence
Component: Code foldingAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal CC: mclaborn, mmetelka
Priority: P3    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Sample application

Description SirIntellegence 2017-03-22 17:28:57 UTC
You get a split second to see the correct line before the editor scrolls down and puts the line out of sight. Sometimes, it will scroll AGAIN when you try to navigate to the destination again, leaving one to obsessively click the navigation thing until it stays where it should be. I suspect this is related to setting collapse imports by default to true and editor folds collapsing.
Comment 1 SirIntellegence 2017-03-22 17:39:39 UTC
An example of such navigation is clicking error links in the output window.
Comment 2 Svata Dedic 2017-05-17 11:11:16 UTC
Created attachment 164339 [details]
Sample application

reproduction case: locate the JPanel form in the explorer. Do not open it directly, but through the navigator open at variable "b".

When the autogenerated code autofolds, the caret position goes out of sight. If cannot be reproduced, fiddle with whitespaces before/after - behaviour likely depends on the screen height.
Comment 3 Svata Dedic 2017-05-18 11:39:15 UTC
*** Bug 267304 has been marked as a duplicate of this bug. ***
Comment 4 Svata Dedic 2017-05-18 11:47:46 UTC
I've patched editor caret + folding to somehow mitigate the issue in jet-main#15039b6a58b8.

Note that because there are more asynchronous processes and I was not able to make the caret position entirely fixed. Sometimes the caret's line will move up or down after autofolding, but will stay visible. Sometimes the screen will momentarily flick as paint on wrong + immediate paint on the correct position occurs.

I am not closing the bug, but lowering the priority - now its "only" visually unpleasant, but you should be able to see the code navigated to.
Comment 5 Quality Engineering 2017-05-24 19:38:47 UTC
Integrated into 'main-silver', will be available in build *201705241652* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/15039b6a58b8
User: Svata Dedic <sdedic@netbeans.org>
Log: #270172: attempt to maintain caret position after autofolding