termites 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.js +25 -12
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1088,22 +1088,35 @@ class TermitesServer {
|
|
|
1088
1088
|
term.onData(data => {
|
|
1089
1089
|
if (ws?.readyState === WebSocket.OPEN && selectedClientId) {
|
|
1090
1090
|
let sendData = data;
|
|
1091
|
+
let shouldSend = true;
|
|
1092
|
+
|
|
1091
1093
|
// Apply Ctrl modifier to keyboard input
|
|
1092
1094
|
if (modifiers.ctrl) {
|
|
1093
|
-
//
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1095
|
+
// Look for any letter in the input (handles IME)
|
|
1096
|
+
let foundLetter = false;
|
|
1097
|
+
for (let i = 0; i < data.length; i++) {
|
|
1098
|
+
const char = data[i];
|
|
1099
|
+
const code = char.toUpperCase().charCodeAt(0);
|
|
1100
|
+
if (code >= 65 && code <= 90) { // A-Z
|
|
1101
|
+
sendData = String.fromCharCode(code - 64);
|
|
1102
|
+
foundLetter = true;
|
|
1103
|
+
// Reset Ctrl after successful use
|
|
1104
|
+
modifiers.ctrl = false;
|
|
1105
|
+
if (ctrlTimeout) { clearTimeout(ctrlTimeout); ctrlTimeout = null; }
|
|
1106
|
+
document.querySelectorAll('.mod-btn[data-mod="ctrl"]').forEach(b => b.classList.remove('active'));
|
|
1107
|
+
break;
|
|
1108
|
+
}
|
|
1103
1109
|
}
|
|
1110
|
+
// If Ctrl is active but no letter found, don't send (wait for letter)
|
|
1111
|
+
if (!foundLetter) {
|
|
1112
|
+
shouldSend = false;
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
if (shouldSend) {
|
|
1117
|
+
ws.send(JSON.stringify({ type: 'input', clientId: selectedClientId, text: sendData }));
|
|
1118
|
+
term.scrollToBottom();
|
|
1104
1119
|
}
|
|
1105
|
-
ws.send(JSON.stringify({ type: 'input', clientId: selectedClientId, text: sendData }));
|
|
1106
|
-
term.scrollToBottom();
|
|
1107
1120
|
}
|
|
1108
1121
|
});
|
|
1109
1122
|
function handleResize() {
|