Shahar Havivi has uploaded a new change for review.

Change subject: ui: EntityModelTextAreaEditor add new line only at the end of 
the text
......................................................................

ui: EntityModelTextAreaEditor add new line only at the end of the text

When editing TextArea and adding 'enter' to the text the enter is
concatenation at the end of the text regardless of the cursor position.

Change-Id: I8a390834a952a4ff41dacb150b58aacfaa680dde
Bug-Url: https://bugzilla.redhat.com/1109330
Signed-off-by: Shahar Havivi <[email protected]>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/generic/EntityModelTextAreaEditor.java
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/41/28741/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/generic/EntityModelTextAreaEditor.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/generic/EntityModelTextAreaEditor.java
index ba38f630..8e54592 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/generic/EntityModelTextAreaEditor.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/editor/generic/EntityModelTextAreaEditor.java
@@ -1,9 +1,10 @@
 package org.ovirt.engine.ui.common.widget.editor.generic;
 
-import com.google.gwt.text.shared.Parser;
-import com.google.gwt.text.shared.Renderer;
 import 
org.ovirt.engine.ui.common.widget.editor.AbstractValueBoxWithLabelEditor;
 import org.ovirt.engine.ui.common.widget.editor.EnterIgnoringFocusHandler;
+
+import com.google.gwt.text.shared.Parser;
+import com.google.gwt.text.shared.Renderer;
 
 public class EntityModelTextAreaEditor<T> extends 
AbstractValueBoxWithLabelEditor<T, EntityModelTextArea<T>> {
 
@@ -24,7 +25,10 @@
             @Override
             protected void enterPressed() {
                 super.enterPressed();
-                getContentWidget().setText(getContentWidget().getText() + 
'\n'); //$NON-NLS-1$
+                int pos = getContentWidget().getCursorPos();
+                
getContentWidget().setText(getContentWidget().getText().substring(0, pos) + '\n'
+                        + getContentWidget().getText().substring(pos)); 
//$NON-NLS-1$
+                getContentWidget().setCursorPos(pos + 1);
             }
         };
 


-- 
To view, visit http://gerrit.ovirt.org/28741
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a390834a952a4ff41dacb150b58aacfaa680dde
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to