improves the implementation of the "jump to line" function in
MainFrame.java. My recent string of commits focused on making DrJava
more responsive contained a troublesome bug that is proving
time-consuming to track down. FindAll result highlights are not
updated properly when a document is edited; the highlights do not move
with the document. When I backed out the refactoring to minimize the
creation of WrappedPositions and the refactoring to defer
reconstructing document positions when a kicked out document is remade
(waiting until the document becomes active), the highlighting bug went
away but when I only backed either of these two refactorings alone,
the bug persisted. This revision backs out both of these
refactorings. In the long term, I would like to see the
reconstruction of wrapped positions deferred until a document becomes
active. This optimization should work! I don't understand it can
affect the highlight updating process since non-active documents are
never edited. On the other hand, the minimization of WrappedPositions
may be an inherently flawed idea. If (and I do not yet know the
answer) the Swing library internally creates Positions that are
critical to updating highlights as a document is edited, then failing
to wrap these Positions could sabotage highlight updating. My
minimization strategy assumes that no Position internally created by
Swing needs to be wrapped.
The good news is that this revsion still appears to improve
responsiveness despite backing out these two refactorings. The key is
a minor change to _jumpToLine in MainFrame.java, which performs the
guts of the "go to line" action (CNTL-G). It makes jumping to a line
near the end of a large document MUCH faster than it has been in
recent builds. The following files were modified or added:
M src/edu/rice/cs/drjava/model/cache/DocumentCache.java
M src/edu/rice/cs/drjava/model/cache/DocumentCacheTest.java
M src/edu/rice/cs/drjava/model/DummyOpenDefDoc.java
M src/edu/rice/cs/drjava/model/AbstractGlobalModel.java
M src/edu/rice/cs/drjava/model/OpenDefinitionsDocument.java
M src/edu/rice/cs/drjava/ui/MainFrame.java
M src/edu/rice/cs/drjava/ui/JUnitPanel.java
M src/edu/rice/cs/util/FileOps.java
M src/edu/rice/cs/util/text/AbstractDocumentInterface.java
M src/edu/rice/cs/util/text/SwingDocument.java
A src/edu/rice/cs/util/text/SwingDocumentInterface.java
A src/edu/rice/cs/util/NullFile.java