termites 1.0.14 → 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 +26 -12
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -724,6 +724,7 @@ class TermitesServer {
|
|
|
724
724
|
<button data-seq="\\x03">^C</button>
|
|
725
725
|
<button data-seq="\\x04">^D</button>
|
|
726
726
|
<button data-seq="\\x1a">^Z</button>
|
|
727
|
+
<button data-seq="\\x0c">^L</button>
|
|
727
728
|
</div>
|
|
728
729
|
|
|
729
730
|
<script src="https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.min.js"></script>
|
|
@@ -1087,22 +1088,35 @@ class TermitesServer {
|
|
|
1087
1088
|
term.onData(data => {
|
|
1088
1089
|
if (ws?.readyState === WebSocket.OPEN && selectedClientId) {
|
|
1089
1090
|
let sendData = data;
|
|
1091
|
+
let shouldSend = true;
|
|
1092
|
+
|
|
1090
1093
|
// Apply Ctrl modifier to keyboard input
|
|
1091
1094
|
if (modifiers.ctrl) {
|
|
1092
|
-
//
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
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
|
+
}
|
|
1102
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();
|
|
1103
1119
|
}
|
|
1104
|
-
ws.send(JSON.stringify({ type: 'input', clientId: selectedClientId, text: sendData }));
|
|
1105
|
-
term.scrollToBottom();
|
|
1106
1120
|
}
|
|
1107
1121
|
});
|
|
1108
1122
|
function handleResize() {
|