Fix bugs reported in Discord
Build and Test j3270 / Build JAR & Run Tests (Java 17) (push) Successful in 33s
Build and Test j3270 / Build JAR & Run Tests (Java 11) (push) Successful in 42s
Build and Test j3270 / Build JAR & Run Tests (Java 21) (push) Successful in 1m17s

This commit is contained in:
2026-09-12 14:58:48 +00:00
parent 46a022d86b
commit c28c097e25
4 changed files with 298 additions and 46 deletions
@@ -54,6 +54,12 @@ public class DataStreamProcessor {
private boolean unlockSysPending = false;
private boolean rcvdRead = false;
// Modal SA (set attribute) character attributes
private byte currentFg = 0;
private byte currentBg = 0;
private byte currentGr = 0;
private byte currentCs = 0;
/** Functional interface for sending output back through the telnet stack. */
@FunctionalInterface
public interface OutputSender {
@@ -240,6 +246,10 @@ public class DataStreamProcessor {
programSymbolManager.commitStagedSymbols();
log.info(">>> EAU: erasing all unprotected fields");
screen.eraseAllUnprotected();
currentFg = 0;
currentBg = 0;
currentGr = 0;
currentCs = 0;
break;
case CMD_WSF:
case SNA_CMD_WSF:
@@ -378,11 +388,19 @@ public class DataStreamProcessor {
if (wccReset(wcc)) {
// Reset all character attributes to defaults
log.fine("WCC reset: clearing default attributes");
currentFg = 0;
currentBg = 0;
currentGr = 0;
currentCs = 0;
}
if (eraseFirst) {
screen.clear();
log.fine("Cleared screen for Erase/Write");
currentFg = 0;
currentBg = 0;
currentGr = 0;
currentCs = 0;
}
// Process orders and data starting at byte 2
@@ -390,9 +408,6 @@ public class DataStreamProcessor {
int end = offset + length;
int baddr = screen.getBufferAddress();
int size = screen.getRows() * screen.getCols();
// Current SA (set attribute) values for character-mode
byte currentFg = 0, currentBg = 0, currentGr = 0, currentCs = 0;
boolean lastWasOrder = false;
while (pos < end) {
@@ -427,10 +442,6 @@ public class DataStreamProcessor {
// FA position is a display position that shows as blank
ea.ec = 0;
ea.ucs4 = ' ';
currentFg = 0;
currentBg = 0;
currentGr = 0;
currentCs = 0;
screen.setFormatted(true);
baddr = (baddr + 1) % size;
screen.setBufferAddress(baddr);
@@ -455,10 +466,6 @@ public class DataStreamProcessor {
ea.clear();
ea.ec = 0;
ea.ucs4 = ' ';
currentFg = 0;
currentBg = 0;
currentGr = 0;
currentCs = 0;
for (int i = 0; i < nPairs; i++) {
int attrType = data[pos + 2 + i * 2] & 0xFF;
@@ -485,6 +492,12 @@ public class DataStreamProcessor {
int attrType = data[pos + 1] & 0xFF;
int attrValue = data[pos + 2] & 0xFF;
switch (attrType) {
case XA_ALL:
currentFg = 0;
currentBg = 0;
currentGr = 0;
currentCs = 0;
break;
case XA_FOREGROUND:
currentFg = (byte) attrValue;
break;