changeset 141:13cea57ac61e

test setfield() cursor movement always sets the field contents
author Carl Byington <carl@five-ten-sg.com>
date Sat, 21 Jun 2014 07:30:09 -0700
parents 4fe73e73d4d7
children e66667cc2473
files src/com/five_ten_sg/connectbot/service/TerminalMonitor.java src/org/tn5250j/framework/tn5250/Screen5250.java
diffstat 2 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Fri Jun 20 19:08:47 2014 -0700
+++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java	Sat Jun 21 07:30:09 2014 -0700
@@ -371,7 +371,7 @@
         for (i = 0; i < da.length; i++) {
             da[i] = data[i + offset];
         }
-
+        if (da.length == 0) da = new char[] {" "};
         buffer.setField(l, c, da);
     }
 
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java	Fri Jun 20 19:08:47 2014 -0700
+++ b/src/org/tn5250j/framework/tn5250/Screen5250.java	Sat Jun 21 07:30:09 2014 -0700
@@ -2685,21 +2685,11 @@
         ScreenField cf;
 
         if (l >= 0) {
-            if (screenFields.isCurrentFieldHighlightedEntry())
-                unsetFieldHighlighted(screenFields.getCurrentField());
-            int pos = l * numCols + c;
-            int   n = screenFields.getSize();
-            for (int i=0; i<n; i++) {
-                cf = screenFields.getField(i);
-                if (cf.getStartPos() == pos) {
-                    screenFields.setCurrentField(cf);
-                    if (screenFields.isCurrentFieldHighlightedEntry())
-                        setFieldHighlighted(screenFields.getCurrentField());
-                    gotoField(cf);
-                    isInField(pos);
-                    break;
-                }
-            }
+            int position = l * numCols + c;
+            isInField(position, true);
+            cf = screenFields.getCurrentField();
+            lastPos = cf.getStartPos();
+            setDirty(lastPos);
         }
 
         if ((data != null) && (data.length > 0)) {