Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting text that was just inserted merges those changes into a change that does nothing, causing an Exception #322

Closed
Crystark opened this issue Jun 8, 2016 · 10 comments
Labels

Comments

@Crystark
Copy link

Crystark commented Jun 8, 2016

Hi,

Since 0.7-M1 I'm getting alot of those:

Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Unexpected change received.
Expected:
PlainTextChange{
    position: 607
    removed: l
    inserted: l
}
Received:
PlainTextChange{
    position: 144
    removed: # .........................
# ..............................
# ............................
# ...............................
# ........
# ..............
# .................................
    inserted: 
}
    at org.fxmisc.undo.impl.UndoManagerImpl.changeObserved(UndoManagerImpl.java:185)
    at org.reactfx.util.QueuingStreamNotifications.lambda$head$0(NotificationAccumulator.java:217)
    at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
    at org.reactfx.SuspendableBase.resume(SuspendableBase.java:64)
    at org.reactfx.CloseableOnceGuard.close(Guard.java:49)
    at org.reactfx.MultiGuard.close(Guard.java:83)
    at org.reactfx.Suspendable$1.resumeSource(Suspendable.java:118)
    at org.reactfx.Suspendable$1.suspendSource(Suspendable.java:104)
    at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134)
    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$3.lambda$observeInputs$0(EventStreams.java:105)
    at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786)
    at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248)
    at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68)
    at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57)
    at org.reactfx.value.ValBase.invalidate(ValBase.java:32)
    at org.reactfx.SuspendableBoolean.release(SuspendableBoolean.java:24)
    at org.reactfx.CloseableOnceGuard.close(Guard.java:49)
    at org.fxmisc.richtext.StyledTextAreaModel.replace(StyledTextAreaModel.java:633)
    at org.fxmisc.richtext.StyledTextAreaModel.replaceText(StyledTextAreaModel.java:620)
    at org.fxmisc.richtext.TextEditingArea.replaceText(TextEditingArea.java:178)
    at org.fxmisc.richtext.EditActions.replaceSelection(EditActions.java:119)
    at org.fxmisc.richtext.StyledTextAreaBehavior.deleteBackward(StyledTextAreaBehavior.java:293)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate.lambda$consume$32(InputMapTemplate.java:107)
    at org.fxmisc.wellbehaved.event.template.PatternActionTemplate.lambda$null$44(InputMapTemplate.java:242)
    at java.util.Optional.map(Optional.java:215)
    at org.fxmisc.wellbehaved.event.template.PatternActionTemplate.lambda$getInputHandlerTemplateMap$45(InputMapTemplate.java:242)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:25)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$2.lambda$null$35(InputMapTemplate.java:180)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$1.lambda$null$30(InputMapTemplate.java:92)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$HandlerTemplateConsumer$1.lambda$accept$29(InputMapTemplate.java:36)
    at org.fxmisc.wellbehaved.event.InputHandler.handle(InputHandler.java:15)
    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.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$KeyHandler.process(Scene.java:3964)
    at javafx.scene.Scene$KeyHandler.access$1800(Scene.java:3910)
    at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2040)
    at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2501)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:197)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:147)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$354(GlassViewEventHandler.java:228)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:227)
    at com.sun.glass.ui.View.handleKeyEvent(View.java:546)
    at com.sun.glass.ui.View.notifyKey(View.java:966)

I haven't been able to reproduce this as I haven't found a pattern. Once this error occurs, nothing really works anymore in the editor and i have to exit the app and reopen it.
It seems to be tied to replaceText (I use shortcuts to comment text) and the undo / redos but i can't find a fixed pattern.

I think this may be connected to #216 #247 and #251
Thanks

@TomasMikula
Copy link
Member

Thanks for reporting. It certainly has to do with undo/redo. The undo manager was probably undoing a change

PlainTextChange{
    position: 607
    removed: l
    inserted: l
}

so it set to expect its inverse (i.e. removed and inserted swapped, which happens to be the same thing in this case). I understand that it never got a notification of this change, since applying it to the document doesn't result in any observable change. Later, when a different edit was made, the undo manager was still expect the previous change that never occurred, so it reported an error. It remains a mystery to me, however, how such a no-op change got to be picked up by the undo manager in the first place.

UndoManager should at least report these errors earlier. That's about all I can do without a reproducible test case. At least it should then be easier to produce one.

@TomasMikula
Copy link
Member

You can try to switch temporarily to the fresh 1.0.0-SNAPSHOT where the undo manager reports these errors earlier. Maybe you will be able to observe a pattern then.

@TomasMikula
Copy link
Member

You can now also switch to 0.7-M2. Hopefully the reported error will now be more useful.

@Crystark
Copy link
Author

Thanks. I haven't had much time to work on this but i'll try and see if i can reproduce it with that version.

@Crystark
Copy link
Author

It seems i'm now able reproduce this easily.
I have a shortcut CTRL+Q to comment / uncomment lines.
If I try to comment (CTRL+Q), then uncomment CTRL+Q then undo with CTRL+Z I get the following:

Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: Expected change not received:
PlainTextChange{
    position: 1548
    removed: Statue of Light,  15, Prayer 7
Statue of Light,  15, Prayer 7
    inserted: Statue of Light,  15, Prayer 7
Statue of Light,  15, Prayer 7
}
    at org.fxmisc.undo.impl.UndoManagerImpl.performChange(UndoManagerImpl.java:178)
    at org.fxmisc.undo.impl.UndoManagerImpl.undo(UndoManagerImpl.java:94)
    at org.fxmisc.richtext.model.UndoActions.undo(UndoActions.java:19)
    at org.fxmisc.richtext.StyledTextAreaBehavior.lambda$static$4(StyledTextAreaBehavior.java:72)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate.lambda$consume$32(InputMapTemplate.java:107)
    at org.fxmisc.wellbehaved.event.template.PatternActionTemplate.lambda$null$44(InputMapTemplate.java:242)
    at java.util.Optional.map(Optional.java:215)
    at org.fxmisc.wellbehaved.event.template.PatternActionTemplate.lambda$getInputHandlerTemplateMap$45(InputMapTemplate.java:242)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:25)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$2.lambda$null$35(InputMapTemplate.java:180)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$1.lambda$null$30(InputMapTemplate.java:92)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$HandlerTemplateConsumer$1.lambda$accept$29(InputMapTemplate.java:36)
    at org.fxmisc.wellbehaved.event.InputHandler.handle(InputHandler.java:15)
    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.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$KeyHandler.process(Scene.java:3964)
    at javafx.scene.Scene$KeyHandler.access$1800(Scene.java:3910)
    at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2040)
    at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2501)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:197)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:147)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$353(GlassViewEventHandler.java:228)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:227)
    at com.sun.glass.ui.View.handleKeyEvent(View.java:546)
    at com.sun.glass.ui.View.notifyKey(View.java:966)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)

here's a small extract of my class to show you how I handle the comments

public class DeckEditor extends CodeArea {

    private static final Pattern                            COMMENT_PATTERN     = Pattern.compile("^ *#(?!#) ?([^\n]*)");

    // ... more code

    public DeckEditor() {
        super();
        init();
    }

    private final void init() {
        setParagraphGraphicFactory(LineNumberFactory.get(this));

        // ... more code

        // Add shortcuts when the scene is set.
        sceneProperty().addListener((obs, old, scene) -> {
            if (scene != null) {
                // CTRL + Q > (un)comment line(s)
                scene.getAccelerators().put(new KeyCodeCombination(KeyCode.Q, KeyCodeCombination.CONTROL_DOWN), () -> {
                    IndexRange range = getSelection();
                    IndexRange linesRange = getSelectionLines(range);
                    String selectedText = getText(linesRange.getStart(), linesRange.getEnd());
                    int originalSize = selectedText.length();
                    if (originalSize != 0) {
                        try (BufferedReader reader = new BufferedReader(new StringReader(selectedText))) {
                            AtomicReference<Integer> firstLineDiffSize = new AtomicReference<>();
                            String replacement = reader.lines().map(l -> {
                                String newline;
                                if (l.trim().isEmpty()) {
                                    newline = "";
                                }
                                else {
                                    Matcher m = COMMENT_PATTERN.matcher(l);
                                    if (m.matches()) {
                                        newline = m.group(1);
                                    }
                                    else if (l.trim().startsWith("#")) {
                                        newline = l;
                                    }
                                    else {
                                        newline = "# " + l;
                                    }
                                }
                                int diff = newline.length() - l.length();
                                firstLineDiffSize.compareAndSet(null, diff);
                                return newline;
                            }).collect(LINE_JOINER);
                            int diffSize = replacement.length() - originalSize;
                            replaceText(linesRange.getStart(), linesRange.getEnd(), replacement);
                            selectRange(
                                Math.max(range.getStart() + firstLineDiffSize.get(), linesRange.getStart()),
                                range.getEnd() + diffSize);
                        }
                        catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                });
                // CTRL + D > duplicate line(s)
                scene.getAccelerators().put(new KeyCodeCombination(KeyCode.D, KeyCodeCombination.CONTROL_DOWN), () -> {
                    IndexRange range = getSelection();
                    IndexRange linesRange = getSelectionLines(range);
                    String selectedText = getText(linesRange.getStart(), linesRange.getEnd());
                    insertText(linesRange.getEnd(), "\n" + selectedText);
                    selectRange(range.getStart(), range.getEnd());
                });
            }
        });
    }

    private IndexRange getSelectionLines(IndexRange range) {
        int firstLineStart = getText().lastIndexOf("\n", range.getStart() - 1) + 1;
        int lastLineEnd = getText().indexOf("\n", range.getEnd());
        if (lastLineEnd == -1) {
            lastLineEnd = getLength();
        }
        return IndexRange.normalize(firstLineStart, lastLineEnd);
    }
}

@TomasMikula
Copy link
Member

TomasMikula commented Jul 19, 2016

Thanks, I found the problem: the two successive changes, comment and uncomment, get merged by the UndoManager into one, which in effect is a no-op. (Note that by default, successive changes are merged if they overlap or are adjacent.) When you then undo the change that is effectively a no-op, no change event is produced, but the UndoManager is still expecting one. This needs to be fixed in RichTextFX, but the fastest way of fixing it in your code is to call

area.getUndoManager().preventMerge();

before and after each comment/uncomment operation, to ensure these changes don't get merged with any previous/subsequent changes. This is the behavior you probably want anyway.

@Crystark
Copy link
Author

Thanks @TomasMikula

That seems to do the trick!

@Crystark
Copy link
Author

@TomasMikula

I'm having an other IllegalStateException. Seems to happens sometimes when i use Undo but couldn't yet find a pattern:

Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: Expected change not received:
PlainTextChange{
    position: 1715
    removed: 7
    inserted: 7
}
    at org.fxmisc.undo.impl.UndoManagerImpl.performChange(UndoManagerImpl.java:178)
    at org.fxmisc.undo.impl.UndoManagerImpl.undo(UndoManagerImpl.java:94)
    at org.fxmisc.richtext.model.UndoActions.undo(UndoActions.java:19)
    at org.fxmisc.richtext.StyledTextAreaBehavior.lambda$static$4(StyledTextAreaBehavior.java:72)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate.lambda$consume$32(InputMapTemplate.java:107)
    at org.fxmisc.wellbehaved.event.template.PatternActionTemplate.lambda$null$44(InputMapTemplate.java:242)
    at java.util.Optional.map(Optional.java:215)
    at org.fxmisc.wellbehaved.event.template.PatternActionTemplate.lambda$getInputHandlerTemplateMap$45(InputMapTemplate.java:242)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:25)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$2.lambda$null$35(InputMapTemplate.java:180)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$1.lambda$null$30(InputMapTemplate.java:92)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputHandlerTemplateMap.lambda$sequence$39(InputHandlerTemplateMap.java:24)
    at org.fxmisc.wellbehaved.event.template.InputMapTemplate$HandlerTemplateConsumer$1.lambda$accept$29(InputMapTemplate.java:36)
    at org.fxmisc.wellbehaved.event.InputHandler.handle(InputHandler.java:15)
    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.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$KeyHandler.process(Scene.java:3964)
    at javafx.scene.Scene$KeyHandler.access$1800(Scene.java:3910)
    at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2040)
    at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2501)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:197)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:147)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$353(GlassViewEventHandler.java:228)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:227)
    at com.sun.glass.ui.View.handleKeyEvent(View.java:546)
    at com.sun.glass.ui.View.notifyKey(View.java:966)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Thread.java:745)

@grigoriliev
Copy link
Contributor

I can easily reproduce this in the latest richtextfx demo by adding a character then removing it and then hit Ctrl+Z. Or by adding several characters then removing those characters and then hit Ctrl+Z.

@JordanMartinez JordanMartinez changed the title java.lang.IllegalArgumentException: Unexpected change received. Deleting text that was just inserted merges those changes into a change that does nothing, causing an Exception Mar 17, 2017
@JordanMartinez
Copy link
Contributor

Closed by #458.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants