diff app/src/main/java/org/tn5250j/framework/tn5250/ScreenField.java @ 445:8fa8e73e2f5c

update to tn5250j version 0.7.7, svn r1270
author Carl Byington <carl@five-ten-sg.com>
date Mon, 04 Jan 2016 15:52:25 -0800
parents d29cce60f393
children
line wrap: on
line diff
--- a/app/src/main/java/org/tn5250j/framework/tn5250/ScreenField.java	Thu Dec 03 12:33:34 2015 -0800
+++ b/app/src/main/java/org/tn5250j/framework/tn5250/ScreenField.java	Mon Jan 04 15:52:25 2016 -0800
@@ -457,24 +457,24 @@
     /**
      * Sets the field's text plane to the specified string. If the string is
      * shorter than the length of the field, the rest of the field is cleared.
-     * If the string is longer than the field, the text is truncated. A subsequent
-     * call to getText on this field will not show the changed text. To see the
-     * changed text, do a refresh on the iOhioFields collection and retrieve the
-     * refreshed field object.
+	 * If the string is longer than the field, the text is truncated. A
+	 * subsequent call to getText on this field will not show the changed text.
+	 * To see the changed text, do a refresh on the iOhioFields collection and
+	 * retrieve the refreshed field object.
      *
-     * @param text - The text to be placed in the field's text plane.
+	 * @param text
+	 *            - The text to be placed in the field's text plane.
      */
     public void setString(String text) {
-		cursorPos = startPos;
+		cursorPos = isRightToLeft() ? endPos - text.length() + 1 : startPos;
 
 		if (isRightToLeft()) {
 			text = new StringBuilder(text).reverse().toString();
 		}
 
-		final ScreenPlanes planes = s.getPlanes();
-		for (int x = 0,len = text.length(); x < length; x++) {
-			char tc = (x < len) ? text.charAt(x) : ' ';
-			planes.setChar(cursorPos, tc);
+		for (int x = 0, textLen = text.length(); x < length; x++) {
+			char tc = x < textLen ? text.charAt(x) : ' ';
+			s.getPlanes().setChar(cursorPos, tc);
 			changePos(1);
 		}
 		setMDT();