changeset 186:61a90cb1938d

setfield positions the cursor properly as if the characters were typed
author Carl Byington <carl@five-ten-sg.com>
date Wed, 02 Jul 2014 15:03:06 -0700
parents c51bcf9f0516
children 81f9ba83c0e9
files src/com/five_ten_sg/connectbot/transport/TN5250.java src/org/tn5250j/framework/tn5250/Screen5250.java
diffstat 2 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java	Wed Jul 02 14:46:16 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java	Wed Jul 02 15:03:06 2014 -0700
@@ -193,13 +193,7 @@
             }
             if (b == 121) {
                 // special case y for testing
-                setField(17, 44, new char[0]);
-                setField(-1, -1, new char[] { '2', '1' });
-                keyPressed(KEY_TAB, ' ', 0);
-                keyPressed(KEY_TAB, ' ', 0);
-                setField(-1, -1, new char[] { '4', '3' });
-                setField(18, 44, new char[0]);
-                setField(-1, -1, new char[] { '6', '5' });
+                setField(17, 43, new char[0]);
                 return;
             }
             if (b == 122) {
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java	Wed Jul 02 14:46:16 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/Screen5250.java	Wed Jul 02 15:03:06 2014 -0700
@@ -2661,9 +2661,15 @@
 
         if (l >= 0) {
             int position = l * numCols + c;
-            isInField(position, true);
-            cf = screenFields.getCurrentField();
-            lastPos = cf.getStartPos();
+            if (!isInField(position, true)) {
+                gotoFieldNext();
+                isInField();
+                cf = screenFields.getCurrentField();
+                lastPos = cf.getStartPos();
+            }
+            else {
+                lastPos = position;
+            }
             setDirty(lastPos);
             fireCursorChanged();
         }