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