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 241898 - Viewport is scrolled to cursor before preferred size has been updated.
Summary: Viewport is scrolled to cursor before preferred size has been updated.
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 7.4
Hardware: PC Mac OS X
: P4 normal with 1 vote (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-15 00:46 UTC by ebakke
Modified: 2016-07-07 17:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ebakke 2014-02-15 00:46:36 UTC
There seems to be a problem in the scroll-to-caret logic in the NetBeans editor where the scroll happens before the editor may have had time to expand its size due to additional lines being added to the text in the editor.

This bug is not too problematic during regular NetBeans IDE use, because it tends to be masked by the "end virtual space" editor feature. But it has caused some problems in my NetBeans Platform application, which features a much smaller editor that's only between 1 and 5 lines tall (an Excel-style formula bar).

To reproduce (method 1):
1) Open a file with at least 10 lines of text for editing.
2) Resize the NetBeans window so that the editor window can only display about 2 lines of text.
3) Move the cursor to the very last line of text.
4) Press enter to insert a new line. The cursor is now halfways outside of the editor viewport. Only once another character is typed does the editor properly scroll vertically to show the entire new line.

To reproduce (method 2):
1) Open a long file for editing (longer than the editor viewport).
2) Select all the text and copy it to the clipboard.
3) Deselect and move the cursor to the last line of the file.
4) Paste. Lots of text is now pasted, and the cursor is now way beyond the viewport. Only if a character is typed does the viewport get scrolled to the bottom of the edited area.

To reproduce (method 3):
1) Set -J-Dorg.netbeans.editor.disable.end.virtual.space=true on NetBeans startup.
2) Edit a long file (longer than the editor viewport).
3) Go to the last line. Press enter to add a new line. The caret disappears beyond the end of the scroll viewport. Only once another character is typed on the new line does the viewport get scrolled all the way down. (This method does not exhibit the bug under normal conditions because the NetBeans editor adds a 1/3rd of the viewport height to the bottom of the editor area by default, and that 1/3rd tends to be longer than the height of one line.)
Comment 1 Martin Balin 2016-07-07 07:27:45 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 2 ebakke 2016-07-07 17:37:01 UTC
Seems to be fixed in the latest build, or at least I can't reproduce it (by "method 1" above) anymore. Thanks!

Product Version: NetBeans IDE Dev (Build 201607070002)
Java: 1.8.0_92; Java HotSpot(TM) 64-Bit Server VM 25.92-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_92-b14
System: Mac OS X version 10.9.5 running on x86_64; UTF-8; en_US (nb)