Skip to content

Moving over whitespace causes exceptions #157

@Arhowk

Description

@Arhowk

(this is just an InlineCssTextArea)

In the picture, lines 4 and 5 have no content (other than a standard \r\n)

tc1

if I put my cursor on line 4 than drag it to line 5, I get the following exception

[01:29] ERR Jun 25, 2015 2:40:34 PM javafx.beans.binding.Bindings$6 computeValue

WARNING: Exception while evaluating binding

java.lang.IllegalArgumentException

at javafx.scene.control.IndexRange.<init>(IndexRange.java:53)

at org.fxmisc.richtext.StyledTextArea.getParagraphSelection(StyledTextArea.java:491)

at org.fxmisc.richtext.skin.StyledTextAreaView.lambda$createCell$134(StyledTextAreaVisual.java:431)

at org.fxmisc.richtext.skin.StyledTextAreaView$$Lambda$518/2079253098.call(Unknown Source)

at javafx.beans.binding.Bindings$6.computeValue(Bindings.java:338)

at javafx.beans.binding.ObjectBinding.get(ObjectBinding.java:153)

at javafx.beans.binding.ObjectExpression.getValue(ObjectExpression.java:50)

at javafx.beans.property.ObjectPropertyBase.get(ObjectPropertyBase.java:132)

at javafx.beans.binding.ObjectExpression.getValue(ObjectExpression.java:50)

at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:178)

at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)

at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105)

at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)

at javafx.beans.property.ObjectPropertyBase.access$000(ObjectPropertyBase.java:51)

at javafx.beans.property.ObjectPropertyBase$Listener.invalidated(ObjectPropertyBase.java:232)

at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:137)

at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)

at javafx.beans.binding.ObjectBinding.invalidate(ObjectBinding.java:172)

at com.sun.javafx.binding.BindingHelperObserver.invalidated(BindingHelperObserver.java:51)

at org.reactfx.value.InvalidationListenerWrapper.accept(Val.java:681)

at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$265(NotificationAccumulator.java:248)

at org.reactfx.util.AbstractReducingStreamNotifications$$Lambda$480/769260606.run(Unknown Source)

at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)

at org.reactfx.SuspendableBase.resume(SuspendableBase.java:64)

at org.reactfx.SuspendableBase$$Lambda$606/872332106.close(Unknown Source)

at org.reactfx.CloseableOnceGuard.close(Guard.java:49)

at org.reactfx.MultiGuard.close(Guard.java:83)

at org.reactfx.BiGuard.close(Guard.java:67)

at org.fxmisc.richtext.StyledTextArea.selectRange(StyledTextArea.java:728)

at org.fxmisc.richtext.NavigationActions.moveTo(NavigationActions.java:44)

at org.fxmisc.richtext.skin.StyledTextAreaBehavior.dragTo(StyledTextAreaBehavior.java:474)

at org.fxmisc.richtext.skin.StyledTextAreaBehavior.mouseDragged(StyledTextAreaBehavior.java:458)

at org.fxmisc.richtext.skin.StyledTextAreaBehavior$$Lambda$455/1456814236.accept(Unknown Source)

at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$262(NotificationAccumulator.java:134)

at org.reactfx.util.NonAccumulativeStreamNotifications$$Lambda$530/1501129407.run(Unknown Source)

at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)

at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)

at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)

at org.reactfx.EventStreams$11$$Lambda$453/732826122.handle(Unknown Source)

at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)

at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)

at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)

at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)

at javafx.event.Event.fireEvent(Event.java:198)

at javafx.scene.Scene$MouseHandler.process(Scene.java:3724)

at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3452)

at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1728)

at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2461)

at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:348)

at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:273)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:382)

at com.sun.glass.ui.View.handleMouseEvent(View.java:553)

at com.sun.glass.ui.View.notifyMouse(View.java:925)

at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)

at com.sun.glass.ui.win.WinApplication$$Lambda$37/1109371569.run(Unknown Source)

at java.lang.Thread.run(Thread.java:745)

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException

at org.fxmisc.richtext.skin.ParagraphText.updateSelectionShape(ParagraphText.java:155)

at org.fxmisc.richtext.skin.ParagraphText.layoutChildren(ParagraphText.java:165)

at javafx.scene.Parent.layout(Parent.java:1074)

at javafx.scene.Parent.layout(Parent.java:1080)

at javafx.scene.Parent.layout(Parent.java:1080)

at org.fxmisc.flowless.VirtualFlowContent.layoutChildren(VirtualFlowContent.java:116)

at javafx.scene.Parent.layout(Parent.java:1074)

at org.fxmisc.flowless.VirtualFlowContent.hit(VirtualFlowContent.java:188)

at org.fxmisc.flowless.VirtualFlow.hit(VirtualFlow.java:225)

at org.fxmisc.richtext.skin.StyledTextAreaView.hit(StyledTextAreaVisual.java:358)

at org.fxmisc.richtext.skin.StyledTextAreaBehavior.dragTo(StyledTextAreaBehavior.java:468)

at org.fxmisc.richtext.skin.StyledTextAreaBehavior.mouseDragged(StyledTextAreaBehavior.java:458)

at org.fxmisc.richtext.skin.StyledTextAreaBehavior$$Lambda$455/1456814236.accept(Unknown Source)

at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$262(NotificationAccumulator.java:134)

at org.reactfx.util.NonAccumulativeStreamNotifications$$Lambda$530/1501129407.run(Unknown Source)

at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)

at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)

at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18)

at org.reactfx.EventStreams$11$$Lambda$453/732826122.handle(Unknown Source)

at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)

at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)

at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)

at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)

at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)

at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)

at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)

at javafx.event.Event.fireEvent(Event.java:198)

at javafx.scene.Scene$MouseHandler.process(Scene.java:3724)

at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3452)

at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1728)

at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2461)

at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:348)

at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:273)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:382)

at com.sun.glass.ui.View.handleMouseEvent(View.java:553)

at com.sun.glass.ui.View.notifyMouse(View.java:925)

at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)

at com.sun.glass.ui.win.WinApplication$$Lambda$37/1109371569.run(Unknown Source)

at java.lang.Thread.run(Thread.java:745)

(I should also mention copy and pasting stuff from the text area adds an extra \n to everything)

Heres the IndexRange code

public IndexRange(@NamedArg("start") int start, @NamedArg("end") int end) {
    if (end < start) {
        throw new IllegalArgumentException();
    }

    this.start = start;
    this.end = end;
}

apparently RichText is getting confused about where a \n fits in selection.

This error also happens with various other selections regarding lines of whitespace and also renders the code area unusuable after error.

Using richtextfx-fat-0.6.4.jar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions