Mercurial > 510Connectbot
diff src/org/tn5250j/framework/tn5250/Screen5250.java @ 184:cdaaa53b5eca
setfield positions the cursor properly as if the characters were typed
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 02 Jul 2014 14:32:13 -0700 |
parents | 97848d5dd28f |
children | c51bcf9f0516 |
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java Wed Jul 02 14:07:03 2014 -0700 +++ b/src/org/tn5250j/framework/tn5250/Screen5250.java Wed Jul 02 14:32:13 2014 -0700 @@ -518,7 +518,7 @@ // gui.repaint(); // } else { goto_XY(pos); - isInField(lastPos); + isInField(); // return back to the calling object that the cursor was indeed // moved with in the screen object return true; @@ -948,9 +948,7 @@ bufferedKeys = null; } - // check to see if position is in a field and if it is then change - // current field to that field - isInField(lastPos, true); + isInField(); if (text.length() == 1 && !text.equals("[") && !text.equals("]")) { setCursorActive(false); @@ -966,9 +964,7 @@ while (!done) { if (strokenizer.hasMoreKeyStrokes()) { - // check to see if position is in a field and if it is - // then change current field to that field - isInField(lastPos, true); + isInField(); s = strokenizer.nextKeyStroke(); if (s.length() == 1) { @@ -1155,7 +1151,7 @@ || screenFields.isCurrentFieldContinuedLast()); } - isInField(lastPos); + isInField(); simulated = true; break; @@ -1230,7 +1226,7 @@ .isCurrentFieldContinuedLast())); } - isInField(lastPos); + isInField(); simulated = true; break; @@ -1334,8 +1330,7 @@ // position to the home position set if (lastPos + numCols + 1 != homePos) { goto_XY(homePos - numCols - 1); - // now check if we are in a field - isInField(lastPos); + isInField(); } else gotoField(1); @@ -1578,7 +1573,7 @@ case RESET: if (isStatusErrorCode()) { resetError(); - isInField(lastPos); + isInField(); updateDirty(); } else { @@ -2679,6 +2674,15 @@ lastPos = cf.getStartPos(); setDirty(lastPos); setDirty(lastPos + cf.getLength()); + lastPos += data.length; + if (!isInField()) { + gotoFieldNext(); + isInField(); + } + cf = screenFields.getCurrentField(); + lastPos = cf.getStartPos(); + setDirty(lastPos); + fireCursorChanged(); } updateDirty(); @@ -3591,13 +3595,13 @@ // - A default starting address of row 1 column 1. if (pendingInsert && homePos > 0) { setCursor(getRow(homePos), getCol(homePos)); - isInField(); // we now check if we are in a field + isInField(); } else { if (!gotoField(1)) { homePos = getPos(1, 1); setCursor(1, 1); - isInField(0, 0); // we now check if we are in a field + isInField(0, 0); } else { homePos = getPos(getCurrentRow(), getCurrentCol());