Bugs item #999059, was opened at 2004-07-27 16:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=438935&aid=999059&group_id=44253
Category: Definitions (source editor)
Group: Ugly
Status: Open
Resolution: None
Priority: 5
Submitted By: Neal Horowitz (nrhorowitz)
Assigned to: Nobody/Anonymous (nobody)
Summary: replacing in inactive documents causes position errors
Initial Comment:
Suppose you replace a string with a shorter string,
choosing "Replace All" with "Search All Documents"
checked. The result is that the old caret position is
out of bounds, which is not an error, but it is
reported badly:
java.lang.IllegalArgumentException: bad position: 6
at
javax.swing.text.JTextComponent.setCaretPosition(Unknown
Source)
at
edu.rice.cs.drjava.ui.AbstractDJPane.setCaretPosition(AbstractDJPane.java:153)
at
edu.rice.cs.drjava.ui.DefinitionsPane.notifyActive(DefinitionsPane.java:1018)
at
edu.rice.cs.drjava.ui.MainFrame._switchDefScrollPane(MainFrame.java:4905)
at
edu.rice.cs.drjava.ui.MainFrame$ModelListener$3.run(MainFrame.java:5684)
at
edu.rice.cs.drjava.ui.MainFrame$ModelListener.activeDocumentChanged(MainFrame.java:5744)
at
edu.rice.cs.drjava.model.DefaultSingleDisplayModel$3.notifyListener(DefaultSingleDisplayModel.java:505)
at
edu.rice.cs.drjava.model.GlobalEventNotifier.notifyListeners(GlobalEventNotifier.java:176)
at
edu.rice.cs.drjava.model.DefaultSingleDisplayModel._setActiveDoc(DefaultSingleDisplayModel.java:499)
at
edu.rice.cs.drjava.model.DefaultSingleDisplayModel.access$000(DefaultSingleDisplayModel.java:96)
at
edu.rice.cs.drjava.model.DefaultSingleDisplayModel$1.itemCase(DefaultSingleDisplayModel.java:126)
at
edu.rice.cs.drjava.model.DefaultSingleDisplayModel$1.itemCase(DefaultSingleDisplayModel.java:137)
at
edu.rice.cs.util.docnavigation.JListNavigator$2.execute(JListNavigator.java:318)
at
edu.rice.cs.drjava.model.DefaultSingleDisplayModel$2.gainedSelection(DefaultSingleDisplayModel.java:144)
at
edu.rice.cs.util.docnavigation.JListNavigator.valueChanged(JListNavigator.java:324)
at javax.swing.JList.fireSelectionValueChanged(Unknown
Source)
(there are a few more, but they're event pump methods
and not very interesting.)
Anyway, this is ugly. It looks like it's
AbstractDJPane's job to catch this and just choose some
unoffensive caret position (probably the end, or maybe
if the offending index is somehow negative you could
make it the beginning, though it doesn't matter much).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=438935&aid=999059&group_id=44253
|