Mercurial > 510Connectbot
diff src/org/tn5250j/framework/tn5250/Screen5250.java @ 187:81f9ba83c0e9
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:40:18 -0700 |
parents | 61a90cb1938d |
children | 561caa2f7c17 |
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/Screen5250.java Wed Jul 02 15:03:06 2014 -0700 +++ b/src/org/tn5250j/framework/tn5250/Screen5250.java Wed Jul 02 15:40:18 2014 -0700 @@ -2662,8 +2662,8 @@ if (l >= 0) { int position = l * numCols + c; if (!isInField(position, true)) { - gotoFieldNext(); - isInField(); + lastPos = position; + while (!isInField()) advancePos(); cf = screenFields.getCurrentField(); lastPos = cf.getStartPos(); } @@ -3576,19 +3576,11 @@ */ protected void changePos(int i) { lastPos += i; - - if (lastPos < 0) - lastPos = lenScreen + lastPos; - - if (lastPos > lenScreen - 1) - lastPos = lastPos - lenScreen; - - // System.out.println(lastRow + "," + ((lastPos) / numCols) + "," + - // lastCol + "," + ((lastPos) % numCols) + "," + - // ((lastRow * numCols) + lastCol) + "," + - // (lastPos)); + while (lastPos < 0) lastPos += lenScreen; + while (lastPos >= lenScreen) lastPos -= lenScreen; } + protected void goHome() { // now we try to move to first input field according to // 14.6 WRITE TO DISPLAY Command