From 523b823dc991e6b7d4b955f61f29adf4c86923ad Mon Sep 17 00:00:00 2001 From: Sun Tan Date: Tue, 13 Feb 2018 12:26:34 +0000 Subject: [PATCH] Fix orion document changing event getting text from native orion event instead of guessing it Signed-off-by: Sun Tan --- .../eclipse/che/ide/editor/orion/client/OrionDocument.java | 4 ++-- .../ide/editor/orion/client/jso/ModelChangedEventOverlay.java | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ide/che-core-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/OrionDocument.java b/ide/che-core-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/OrionDocument.java index 53fd466ecee..6c8dea7a5ef 100644 --- a/ide/che-core-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/OrionDocument.java +++ b/ide/che-core-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/OrionDocument.java @@ -91,7 +91,7 @@ private void fireDocumentChangeEvent(final ModelChangedEventOverlay param) { int addedCharCount = param.addedCharCount(); int removedCharCount = param.removedCharCount(); - String text = editorOverlay.getModel().getText(startOffset, startOffset + addedCharCount); + String text = param.getText(); final DocumentChangedEvent event = new DocumentChangedEvent(this, startOffset, addedCharCount, text, removedCharCount); @@ -104,7 +104,7 @@ private void fireDocumentChangingEvent(final ModelChangedEventOverlay param) { int addedCharCount = param.addedCharCount(); int removedCharCount = param.removedCharCount(); - String text = editorOverlay.getModel().getText(startOffset, startOffset + addedCharCount); + String text = param.getText(); final DocumentChangingEvent event = new DocumentChangingEvent(this, startOffset, addedCharCount, text, removedCharCount); diff --git a/ide/che-core-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/jso/ModelChangedEventOverlay.java b/ide/che-core-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/jso/ModelChangedEventOverlay.java index 8089413357b..d481bd8b52f 100644 --- a/ide/che-core-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/jso/ModelChangedEventOverlay.java +++ b/ide/che-core-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/jso/ModelChangedEventOverlay.java @@ -42,4 +42,8 @@ public final native int removedLineCount() /*-{ public final native int start() /*-{ return this.start; }-*/; + + public final native String getText() /*-{ + return this.text; + }-*/; }