Rearrange settings, update sample config
Build and Test j3270 / Build JAR & Run Tests (Java 11) (push) Successful in 1m8s
Build and Test j3270 / Build JAR & Run Tests (Java 21) (push) Successful in 1m15s
Build and Test j3270 / Build JAR & Run Tests (Java 17) (push) Successful in 1m38s
Release j3270 / Build & Publish Release (push) Successful in 1m13s

This commit is contained in:
2026-09-15 17:59:26 +00:00
parent 7892229a2c
commit 754b1de7cb
22 changed files with 1530 additions and 237 deletions
@@ -546,6 +546,29 @@ public class ECLPS implements ECLConstants {
private boolean enablePasteFromExcel = true;
private boolean pasteStopAtProtectedLine = false;
private boolean blockPaste = true;
public boolean isBlockPaste() {
if (session != null && session.getProperties() != null) {
String p = session.getProperties().getProperty(ECLSession.BLOCK_PASTE);
if (p != null) return Boolean.parseBoolean(p);
}
return blockPaste;
}
public boolean IsBlockPaste() { return isBlockPaste(); }
public void setBlockPaste(boolean val) {
this.blockPaste = val;
if (session != null && session.getProperties() != null) {
session.getProperties().setProperty(ECLSession.BLOCK_PASTE, String.valueOf(val));
}
if (inputProcessor != null) {
inputProcessor.setBlockPaste(val);
}
}
public void SetBlockPaste(boolean val) { setBlockPaste(val); }
public boolean isEnablePasteFromExcel() {
if (session != null && session.getProperties() != null) {
@@ -591,7 +614,7 @@ public class ECLPS implements ECLConstants {
setCursorPos(row, col);
}
if (inputProcessor != null) {
return inputProcessor.pasteText(text, true, isPasteStopAtProtectedLine());
return inputProcessor.pasteText(text, true, isPasteStopAtProtectedLine(), isBlockPaste());
}
return 0;
}
@@ -605,9 +628,9 @@ public class ECLPS implements ECLConstants {
*/
public synchronized int pasteString(String text, int row, int col) {
if (text == null || text.isEmpty() || screen == null) return 0;
if (inputProcessor != null && (text.contains("\t") || isEnablePasteFromExcel() || isPasteStopAtProtectedLine())) {
if (inputProcessor != null && (text.contains("\t") || isEnablePasteFromExcel() || isPasteStopAtProtectedLine() || isBlockPaste())) {
setCursorPos(row, col);
return inputProcessor.pasteText(text, isEnablePasteFromExcel(), isPasteStopAtProtectedLine());
return inputProcessor.pasteText(text, isEnablePasteFromExcel(), isPasteStopAtProtectedLine(), isBlockPaste());
}
int rows = screen.getRows();
int cols = screen.getCols();
@@ -38,6 +38,7 @@ public class ECLSession {
public static final String ENABLE_PASTE_FROM_EXCEL = "enablePasteFromExcel";
public static final String PASTE_TAB_OPTIONS = "pasteTabOptions";
public static final String PASTE_STOP_AT_PROTECTED_LINE = "pasteStopAtProtectedLine";
public static final String BLOCK_PASTE = "blockPaste";
public static final String PASTE_FIELD_WRAP = "pasteFieldWrap";
public static final String PASTE_LINE_WRAP = "pasteLineWrap";
public static final String ENTRYASSIST_DOCMODE = "EntryAssist_DOCmode";
@@ -137,6 +137,10 @@ public class InputProcessor {
private boolean aplKeyboardMode = false;
private boolean numericFieldLock = true;
private boolean autoSkipEnabled = true;
private boolean blockPaste = true;
public boolean isBlockPaste() { return blockPaste; }
public void setBlockPaste(boolean val) { this.blockPaste = val; }
public void setBellListener(BellListener listener) { this.bellListener = listener; }
public BellListener getBellListener() { return bellListener; }
@@ -446,6 +450,19 @@ public class InputProcessor {
* @return number of characters pasted
*/
public int pasteText(String text, boolean enablePasteFromExcel, boolean pasteStopAtProtectedLine) {
return pasteText(text, enablePasteFromExcel, pasteStopAtProtectedLine, this.blockPaste);
}
/**
* Pastes text onto the screen with tabular, boundary, and block alignment controls.
*
* @param text text to paste
* @param enablePasteFromExcel whether to parse tabs as field advances and newlines as row advances
* @param pasteStopAtProtectedLine whether to halt paste when encountering protected boundaries
* @param blockPaste whether newlines align each line with the initial starting cursor column
* @return number of characters pasted
*/
public int pasteText(String text, boolean enablePasteFromExcel, boolean pasteStopAtProtectedLine, boolean blockPaste) {
if (text == null || text.isEmpty() || screen == null || keyboardLocked) {
return 0;
}
@@ -463,6 +480,7 @@ public class InputProcessor {
int count = 0;
int len = text.length();
int i = 0;
int startCol = screen.getCursorCol();
while (i < len && !keyboardLocked) {
char ch = text.charAt(i);
@@ -472,7 +490,34 @@ public class InputProcessor {
if (ch == '\r' && (i + 1) < len && text.charAt(i + 1) == '\n') {
i++; // skip \n of \r\n
}
if (enablePasteFromExcel) {
if (blockPaste) {
int curRow = screen.getCursorRow();
int nextRow = (curRow + 1) % screen.getRows();
if (pasteStopAtProtectedLine && isLineProtected(nextRow)) {
break; // Stop paste when next line is protected
}
int cols = screen.getCols();
int rows = screen.getRows();
int targetAddr = nextRow * cols + startCol;
if (screen.isFormatted()) {
int size = rows * cols;
ExtendedAttribute ea = screen.getCell(targetAddr);
if (ea.isFieldAttribute()) {
targetAddr = (targetAddr + 1) % size;
}
byte faVal = screen.getFieldAttributeAt(targetAddr);
if (faIsProtected(faVal & 0xFF)) {
if (pasteStopAtProtectedLine) {
break;
} else {
targetAddr = screen.findNextUnprotected(targetAddr == 0 ? (size - 1) : (targetAddr - 1));
}
}
}
screen.setCursorAddress(targetAddr);
screen.markAllChanged();
screen.updateDisplaySnapshot();
} else if (enablePasteFromExcel) {
int curRow = screen.getCursorRow();
int nextRow = (curRow + 1) % screen.getRows();
if (pasteStopAtProtectedLine && isLineProtected(nextRow)) {