scijava / script-editor

Script Editor and Interpreter for SciJava script languages
http://imagej.net/Script_Editor
BSD 2-Clause "Simplified" License
12 stars 12 forks source link

BadLocationException in Python Auto-completion #49

Closed haesleinhuepf closed 3 years ago

haesleinhuepf commented 3 years ago

Hi @acardona ,

when hitting CTRL+Space behind a single line containing "Views", a BadLocationException pops up:

javax.swing.text.BadLocationException: No such line
    at javax.swing.JTextArea.getLineStartOffset(JTextArea.java:409)
    at org.scijava.ui.swing.script.autocompletion.JythonAutoCompletion.insertCompletion(JythonAutoCompletion.java:74)
    at org.fife.ui.autocomplete.AutoCompletion.insertCompletion(AutoCompletion.java:609)
    at org.fife.ui.autocomplete.AutoCompletion.lambda$refreshPopupWindow$1(AutoCompletion.java:881)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

image

Let me know if I can help fixing it!

Cheers, Robert

acardona commented 3 years ago

Thanks, will fix. As a quick workaround, leave an empty line at the beginning of the script.

I suspect the issue is that lines in the RSyntaxArea may be 1-based and not 0-based.

Albert

On Nov 30, 2020, at 8:57 AM, Robert Haase notifications@github.com wrote:

 Hi @acardona ,

when hitting CTRL+Space behind a single line containing "Views", a NullPointerException pops up:

javax.swing.text.BadLocationException: No such line at javax.swing.JTextArea.getLineStartOffset(JTextArea.java:409) at org.scijava.ui.swing.script.autocompletion.JythonAutoCompletion.insertCompletion(JythonAutoCompletion.java:74) at org.fife.ui.autocomplete.AutoCompletion.insertCompletion(AutoCompletion.java:609) at org.fife.ui.autocomplete.AutoCompletion.lambda$refreshPopupWindow$1(AutoCompletion.java:881) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Let me know if I can help fixing it!

Cheers, Robert

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.