From 540c406c7bf144359ef9affb9bc4ebfdf1ce2073 Mon Sep 17 00:00:00 2001 From: Sun Seng David TAN Date: Mon, 14 Mar 2016 21:10:01 +0000 Subject: [PATCH] Fix DocuementChange event for Orion editor. Signed-off-by: Sun Seng David TAN --- .../ide/editor/orion/client/OrionDocument.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/plugins/plugin-orion/che-plugin-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/OrionDocument.java b/plugins/plugin-orion/che-plugin-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/OrionDocument.java index 0b88876891..bed31fc265 100644 --- a/plugins/plugin-orion/che-plugin-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/OrionDocument.java +++ b/plugins/plugin-orion/che-plugin-orion-editor/src/main/java/org/eclipse/che/ide/editor/orion/client/OrionDocument.java @@ -64,24 +64,15 @@ public class OrionDocument extends AbstractEmbeddedDocument { int startOffset = param.start(); int addedCharCount = param.addedCharCount(); int removedCharCount = param.removedCharCount(); - int length = 0; - if (addedCharCount != 0) { - //adding - length = addedCharCount; - } else if (removedCharCount != 0) { - //deleting - //TODO there may be bug - length = removedCharCount; - startOffset = startOffset - length; - } - String text = editorOverlay.getModel().getText(startOffset, startOffset + length); + + String text = editorOverlay.getModel().getText(startOffset, startOffset + addedCharCount); final DocumentChangeEvent event = new DocumentChangeEvent(this, startOffset, - length, + addedCharCount, text, - removedCharCount);//TODO: need check removedCharCount add it for fix + removedCharCount); // according to https://github.com/codenvy/che-core/pull/122 getDocEventBus().fireEvent(event); }