termites 1.0.12 → 1.0.14
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 +18 -0
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -720,6 +720,7 @@ class TermitesServer {
|
|
|
720
720
|
<button data-key="ArrowLeft">←</button>
|
|
721
721
|
<button data-key="ArrowRight">→</button>
|
|
722
722
|
<div class="sep"></div>
|
|
723
|
+
<button data-seq="/">/</button>
|
|
723
724
|
<button data-seq="\\x03">^C</button>
|
|
724
725
|
<button data-seq="\\x04">^D</button>
|
|
725
726
|
<button data-seq="\\x1a">^Z</button>
|
|
@@ -953,6 +954,13 @@ class TermitesServer {
|
|
|
953
954
|
'ArrowRight': '\\x1b[1;5C',
|
|
954
955
|
'ArrowLeft': '\\x1b[1;5D'
|
|
955
956
|
};
|
|
957
|
+
// Alt + key sequences
|
|
958
|
+
const altKeyMap = {
|
|
959
|
+
'ArrowUp': '\\x1b[1;3A',
|
|
960
|
+
'ArrowDown': '\\x1b[1;3B',
|
|
961
|
+
'ArrowRight': '\\x1b[1;3C',
|
|
962
|
+
'ArrowLeft': '\\x1b[1;3D'
|
|
963
|
+
};
|
|
956
964
|
|
|
957
965
|
toolbar.querySelectorAll('button').forEach(btn => {
|
|
958
966
|
// Use touchstart to prevent losing focus on terminal
|
|
@@ -992,6 +1000,16 @@ class TermitesServer {
|
|
|
992
1000
|
} else {
|
|
993
1001
|
data = keyMap[key] || '';
|
|
994
1002
|
}
|
|
1003
|
+
} else if (modifiers.alt) {
|
|
1004
|
+
// Alt + key
|
|
1005
|
+
if (altKeyMap[key]) {
|
|
1006
|
+
data = altKeyMap[key];
|
|
1007
|
+
} else if (key.length === 1) {
|
|
1008
|
+
// Alt + letter sends ESC + letter
|
|
1009
|
+
data = '\\x1b' + key;
|
|
1010
|
+
} else {
|
|
1011
|
+
data = keyMap[key] || '';
|
|
1012
|
+
}
|
|
995
1013
|
} else {
|
|
996
1014
|
data = keyMap[key] || '';
|
|
997
1015
|
}
|