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

Cut, Copy, Paste #55

Closed
ghost opened this issue May 14, 2014 · 16 comments
Closed

Cut, Copy, Paste #55

ghost opened this issue May 14, 2014 · 16 comments

Comments

@ghost
Copy link

ghost commented May 14, 2014

Hi Tomas, I am trying to implement a cut/copy/paste with styles. I ran into this errort:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at org.fxmisc.richtext.EditableStyledDocument.lambda$replace$23(EditableStyledDocument.java:177)
at org.fxmisc.richtext.EditableStyledDocument$$Lambda$73/127329777.apply(Unknown Source)
at org.fxmisc.richtext.EditableStyledDocument.replace(EditableStyledDocument.java:449)
at org.fxmisc.richtext.EditableStyledDocument.replace(EditableStyledDocument.java:176)
at org.fxmisc.richtext.StyledTextArea.replace(StyledTextArea.java:607)
at org.fxmisc.richtext.EditActions.insert(EditActions.java:66)
at TextComponentElements.TextEditorViewPort.lambda$insertStyledDoc$12(TextEditorViewPort.java:676)
at TextComponentElements.TextEditorViewPort$$Lambda$126/971233447.run(Unknown Source)
at org.reactfx.InterceptableEventStream.muteWhile(InterceptableEventStream.java:32)
at TextComponentElements.TextEditorViewPort.insertStyledDoc(TextEditorViewPort.java:675)
at TextComponentElements.TextEditor$24.handle(TextEditor.java:684)
at TextComponentElements.TextEditor$24.handle(TextEditor.java:681)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
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.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
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:49)
at javafx.event.Event.fireEvent(Event.java:204)
at javafx.scene.control.MenuItem.fire(MenuItem.java:462)
at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1344)
at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1319)
at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer$7.handle(ContextMenuContent.java:1287)
at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer$7.handle(ContextMenuContent.java:1285)
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:204)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:314)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:345)
at com.sun.glass.ui.View.handleMouseEvent(View.java:526)
at com.sun.glass.ui.View.notifyMouse(View.java:898)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at org.reactfx.LazilyBoundStream.noSubscribers(LazilyBoundStream.java:22)
at org.reactfx.EventStreamBase.unsubscribe(EventStreamBase.java:43)
at org.reactfx.EventStreamBase.lambda$subscribe$1(EventStreamBase.java:37)
at org.reactfx.EventStreamBase$$Lambda$30/530155528.unsubscribe(Unknown Source)
at TextComponentElements.TextEditorViewPort.unSubscribe(TextEditorViewPort.java:1234)
at TextComponentElements.TextEditorViewPort.insertStyledDoc(TextEditorViewPort.java:670)
at TextComponentElements.TextEditor$24.handle(TextEditor.java:684)
at TextComponentElements.TextEditor$24.handle(TextEditor.java:681)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
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.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
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:49)
at javafx.event.Event.fireEvent(Event.java:204)
at javafx.scene.control.MenuItem.fire(MenuItem.java:462)
at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1344)
at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1319)
at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer$7.handle(ContextMenuContent.java:1287)
at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer$7.handle(ContextMenuContent.java:1285)
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:204)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:314)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:345)
at com.sun.glass.ui.View.handleMouseEvent(View.java:526)
at com.sun.glass.ui.View.notifyMouse(View.java:898)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:745)

The code I am using is this:

sceneRoot.addEventFilter(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() {
        @Override
        public void handle(KeyEvent event) {

            if (cut.match(event)) {
                cutStyledDoc = activePort.richTextArea.subDocument(activePort.richTextArea.getSelection().getStart(), activePort.richTextArea.getSelection().getEnd());
                activePort.richTextArea.cut();
            } else if (paste.match(event)) {
                activePort.insertStyledDoc(cutStyledDoc);
            } else if (copy.match(event)) {
                cutStyledDoc = activePort.richTextArea.subDocument(activePort.richTextArea.getSelection().getStart(), activePort.richTextArea.getSelection().getEnd());
            }
        }
    });

where

InsertStyleDoc is:

public void insertStyledDoc(StyledDocument styledDocument) {
    unSubscribe();
    if (this.richTextArea.getSelection() != null && this.richTextArea.getSelection().getEnd() > this.richTextArea.getSelection().getStart()) {//if there is a selection
        this.richTextArea.replace(this.richTextArea.getSelection(), styledDocument);
    } else {//no selection
        InterceptableEventStream<PlainTextChange> changes = this.richTextArea.plainTextChanges().interceptable();
        changes.muteWhile(() -> {
            this.richTextArea.insert(this.richTextArea.getCaretPosition(), styledDocument);
        });
    }

    subscribe();
}

the subscription is being enabled and disabled to allow the insertion to come in with style, and not the style at caret, which is defined the subscription to change.

@ghost
Copy link
Author

ghost commented May 14, 2014

T clarify, when I try to paste using the shortcut, it pastes, but whatever is being pasted comes in with the style at caret. The second issue, is that when I try to paste using a menuItem from a context menu, it gives this error.

both use the same exact code.

I just factored the code into separate method as below:

public void addCCPhandler(){
sceneRoot.addEventFilter(KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() {
        @Override
        public void handle(KeyEvent event) {
            if (cut.match(event)) {
                doTheCut();
            } else if (paste.match(event)) {
                doThePaste();
            } else if (copy.match(event)) {
                doTheCopy();
            }
        }
    });

}

public void doTheCut() {
    cutStyledDoc = activePort.richTextArea.subDocument(activePort.richTextArea.getSelection().getStart(), activePort.richTextArea.getSelection().getEnd());
    activePort.richTextArea.cut();
}
public void doThePaste() {
    activePort.insertStyledDoc(cutStyledDoc);
}
public void doTheCopy() {
    cutStyledDoc = activePort.richTextArea.subDocument(activePort.richTextArea.getSelection().getStart(), activePort.richTextArea.getSelection().getEnd());
}

I run into the same NPE and sometimes things get pasted without the correct style, and some other times, the cutStyledDoc variables does nt get updated correctly.

Any feedback on this would be great.
Thanks for your help in advance!
maher

@TomasMikula
Copy link
Member

Hi Maher,

are you sure styledDocument on the following line is not null?

this.richTextArea.insert(this.richTextArea.getCaretPosition(), styledDocument);

@ghost
Copy link
Author

ghost commented May 14, 2014

Hi Tomas, I am trying to verify that. The same code works on menu items well and not when using the shortcuts. I am writing a check on that as we speak. will report shortly. any ideas though on the insert with styling?
i'll write back soon

@ghost
Copy link
Author

ghost commented May 14, 2014

HI, I added these checks to the CCP code:

public void doTheCut() {
    if (activePort.richTextArea.getSelectedText().length() > 0) {
        cutStyledDoc = activePort.richTextArea.subDocument(activePort.richTextArea.getSelection().getStart(), activePort.richTextArea.getSelection().getEnd());
        activePort.richTextArea.cut();
    }
}

public void doThePaste() {
    activePort.insertStyledDoc(cutStyledDoc);
}

public void doTheCopy() {
    if (activePort.richTextArea.getSelectedText().length() > 0) {
        cutStyledDoc = activePort.richTextArea.subDocument(activePort.richTextArea.getSelection().getStart(), activePort.richTextArea.getSelection().getEnd());
    }
}

/////

Now it pastes, but it shows this error after.

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at org.fxmisc.richtext.EditableStyledDocument.lambda$replace$23(EditableStyledDocument.java:177)
at org.fxmisc.richtext.EditableStyledDocument$$Lambda$73/817212663.apply(Unknown Source)
at org.fxmisc.richtext.EditableStyledDocument.replace(EditableStyledDocument.java:449)
at org.fxmisc.richtext.EditableStyledDocument.replace(EditableStyledDocument.java:176)
at org.fxmisc.richtext.StyledTextArea.replace(StyledTextArea.java:607)
at org.fxmisc.richtext.EditActions.insert(EditActions.java:66)
at TextComponentElements.TextEditorViewPort.lambda$insertStyledDoc$12(TextEditorViewPort.java:676)
at TextComponentElements.TextEditorViewPort$$Lambda$126/549457403.run(Unknown Source)
at org.reactfx.InterceptableEventStream.muteWhile(InterceptableEventStream.java:32)
at TextComponentElements.TextEditorViewPort.insertStyledDoc(TextEditorViewPort.java:675)
at TextComponentElements.TextEditor.doThePaste(TextEditor.java:741)
at TextComponentElements.TextEditor$30.handle(TextEditor.java:724)
at TextComponentElements.TextEditor$30.handle(TextEditor.java:718)
at com.sun.javafx.event.CompositeEventHandler$NormalEventFilterRecord.handleCapturingEvent(CompositeEventHandler.java:282)
at com.sun.javafx.event.CompositeEventHandler.dispatchCapturingEvent(CompositeEventHandler.java:98)
at com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:223)
at com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:180)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
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:204)
at javafx.scene.Scene$KeyHandler.process(Scene.java:3949)
at javafx.scene.Scene$KeyHandler.access$2100(Scene.java:3896)
at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2036)
at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2493)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:170)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:123)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:197)
at com.sun.glass.ui.View.handleKeyEvent(View.java:517)
at com.sun.glass.ui.View.notifyKey(View.java:927)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:745)

The code where it breaks is:
this.richTextArea.insert(this.richTextArea.getCaretPosition(), styledDocument);

in:

 public void insertStyledDoc(StyledDocument styledDocument) {
    unSubscribe();
    if (this.richTextArea.getSelection() != null && this.richTextArea.getSelection().getEnd() > this.richTextArea.getSelection().getStart()) {//if there is a selection
        this.richTextArea.replace(this.richTextArea.getSelection(), styledDocument);
    } else {//no selection
        InterceptableEventStream<PlainTextChange> changes = this.richTextArea.plainTextChanges().interceptable();
        changes.muteWhile(() -> {
            this.richTextArea.insert(this.richTextArea.getCaretPosition(), styledDocument);
        });
    }

    subscribe();
}

@ghost
Copy link
Author

ghost commented May 14, 2014

for sure, the menu item action works better. would it be because of the keyevent gets triggered multiple times as the key is being pressed?

@TomasMikula
Copy link
Member

What I meant was to add this check at the beginning of your insertStyledDoc:

if(styledDocument == null) {
    throw new AssertionError("Trying to insert null");
}

@ghost
Copy link
Author

ghost commented May 14, 2014

no errors. I'll do more inspection and report back.

@ghost
Copy link
Author

ghost commented May 14, 2014

Hi, after extensive testing, i am convinced it has to do with key listening filter. I added a counter that would increase when pressing the combination, and it does go beyond 1. so what I do, is only copy/cut when it is 0 so I dont run into the null value for styledoc. and this counter gets reset to zero when the C or X keys are released.

@ghost
Copy link
Author

ghost commented May 14, 2014

sorry for the false alarm.

@ghost
Copy link
Author

ghost commented May 14, 2014

The only issue I have left is that pasting using the shortcut, does not come with the original styled Doc style. It comes with whatever the style at caret is.

this is the method that inserts:

public void insertStyledDoc(StyledDocument styledDocument) {
unSubscribe();
if (this.richTextArea.getSelection() != null && this.richTextArea.getSelection().getEnd() > this.richTextArea.getSelection().getStart()) {//if there is a selection
    this.richTextArea.replace(this.richTextArea.getSelection(), styledDocument);
} else {//no selection
    InterceptableEventStream<PlainTextChange> changes = this.richTextArea.plainTextChanges().interceptable();
    changes.muteWhile(() -> {
        this.richTextArea.insert(this.richTextArea.getCaretPosition(), styledDocument);
    });
}

subscribe();

}

This is the subscribe and unsubscribe methods.

public void unSubscribe() {
    subtoChange.unsubscribe();
}

public void subscribe() {
    subtoChange = richTextArea.plainTextChanges().subscribe(change -> {
        if (richTextArea.getUndoManager().isPerformingAction()) {
            return;
        } else {
            int from = change.getPosition();
            int length = change.getInserted().length();
            richTextArea.setStyle(from, from + length, styleToUse.get());
        }
    });
}

When I trigger this method using the menu items, inserting the styled doc come in with its original style, but with the shortcut, it comes in based on the style assigned t caret.

@TomasMikula
Copy link
Member

Sorry, I must have overlooked your last comment :(

Whether your method is triggered by a menu item or a keyboard shortcut really shouldn't matter. Are you sure your insertStyledDoc method is actually invoked in both cases? If the combination is "Ctrl+V", it might be the case that the event is consumed by the text area and it's own paste method is invoked.

Some further comments on your code:

  • You shouldn't need to check that this.richTextArea.getSelection() != null. The returned selection should never be null. If it is, it's a bug.

  • Your changes.muteWhile(...) has no effect, it doesn't mute the underlying change stream, and no one is subscribed to the temporary changes stream. What you should do is to have a private field

    private final InterceptableEventStream<PlainTextChange> changes;

    in your object that holds the text area. Initialize and subscribe to it in your constructor:

    this.changes = this.richTextArea.plainTextChanges().interceptable();
    this.subtoChange = this.changes.subscribe(change -> {
        // ...
    });

    Then, when you need to temporarily unsubscribe, you don't need your unSubscribe and subscribe methods for that, that's what muteWhile is for:

    this.changes.muteWhile(() -> {
        // do something, changes done to text area will be ignored
    });
  • replace also works on empty selection, so you shouldn't need this

    if(/* there is selection */) {
        // replace
    } else {
        // insert
    }

    but the following should work for you

    richTextArea.replaceSelection(styledDocument);
  • All in all, your insertStyledDoc method could look like this

    public void insertStyledDoc(StyledDocument styledDocument) {
        this.changes.muteWhile(() -> {
            this.richTextArea.replaceSelection(styledDocument);
        });
    }

@ghost
Copy link
Author

ghost commented May 30, 2014

Hi Tomas, Thanks for the feedback. I really appreciate your help.

I changes the code as you advised, but I am getting the same thing.
Pasting with a menu item action inserts with original styles, but with a
short-cut, inserts with styles at caret. However, both call the same
method. I am not sure why this is happening :[

It is OK for now I guess. Hopefully once I get things done I will post
all the code for you to look at-- I can not do that now just yet. As
soon as I can I'll send you a note.

That being said, I can market it as a cool feature though: inserting
with original styles VS inserting with style at caret.

Best,
Maher

On 30/05/2014 9:21 AM, TomasMikula wrote:

this.subtoChange = this.changes.subscribe(change -> {
// ...
});

@TomasMikula
Copy link
Member

I didn't expect the changes I suggested to fix your problem, just to clean your code a little bit.

Did you make sure that insertStyledDoc actually is called when your press the key combination? Try putting System.out.println("INSERTING"); to your insertStyledDoc method and see if it gets printed when you press your key combination.

Is your key combination "Ctrl+V" or something else?

@ghost
Copy link
Author

ghost commented May 31, 2014

Hi Tomas, yes it is CNTRL+V. and I did all the checking. it does call
the methods as expected. i think it is a result of my messy code. sigh...

On 30/05/2014 12:18 PM, TomasMikula wrote:

I didn't expect the changes I suggested to fix your problem, just to
clean your code a little bit.

Did you make sure that |insertStyledDoc| actually is called when your
press the key combination? Try putting
|System.out.println("INSERTING");| to your |insertStyledDoc| method
and see if it gets printed when you press your key combination.

Is your key combination "Ctrl+V" or something else?


Reply to this email directly or view it on GitHub
#55 (comment).

@ghost
Copy link
Author

ghost commented Nov 24, 2014

So is this actually resolved as invalid? I'd like to see it closed so people don't investigate too much time considering this as a duplicate.

@TomasMikula
Copy link
Member

Right.

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

No branches or pull requests

1 participant