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.
Created attachment 142108 [details] source code for trivial module to reproduce issue vim, and so jVi, has a different model for code folding commands. One difference is that the caret does not move when collapse/expand folds. I've attached trivial module source for reproducing the issue, see below. For NB-7.2,7.3 the following works fh.render(new Runnable() { void run() { int dot = baseCaret.getDot(); // close folds ... baseCaret.setDot(dot, false); } } with NB-74 it fails, the caret gets moved to the beginning of the closed fold. It looks like expand fold doesn't need to have the caret moved back at all. If I do the setDot with EventQueue.invokeLater then it works. I'll make that change, probably qualified by version number so it only applies to 7.4. I always wonder how/when it will break and what else might get affected when this is the fix. But I'm hoping you can illuminate me on the change and where to look in the source code to understand it. This could save me considerable time tracking it down to get a sense of how well (and for how long) the invokeLater fix will work. And for the expand fold, will it be safe to leave out the invokeLater? (I'll probably leave the setDot for the expand since that meets my level of paranoia) To reproduce: With module installed, put cursor on some line in a fold, (not the first line of the fold). Take note of the cursor line number in the status display. Then Menu>Editor>CollapseFold, note that the line number has changed. If you modify the source to use the invokeLater, line does not change.
The code was restructured in 7.4. Even the original code posted some caret changes into SwingUtilities.invokeLater queue; it may be possible that with the new code, your FoldHierarchyListener comes earlier. Are you 100% sure your FHListener runs in ED thread ?