blob: 2c1849d637df58bc9b62dfcab0ccdbe3d3615bbd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import { installImeBypass } from "./ime-bypass.js";
import {
installSoftKeyboardCapture,
suppressSoftKeyboardOnTouch,
} from "./soft-keyboard.js";
import { installCustomKeyHandler } from "./key-handler.js";
import { installMouseHandlers } from "./mouse.js";
import { createPinchController } from "./pinch.js";
import { installTouchGestures } from "./touch.js";
export { setSoftKeyboard } from "./soft-keyboard.js";
export function setupInputHandlers(term, fitAddon, sendFunction) {
installImeBypass(term, sendFunction);
installSoftKeyboardCapture(term, sendFunction);
suppressSoftKeyboardOnTouch(term);
installCustomKeyHandler(term, sendFunction);
const terminalElement = document.getElementById("terminal");
installMouseHandlers(term, terminalElement, sendFunction);
const pinch = createPinchController(term);
installTouchGestures({ term, terminalElement, sendFunction, pinch });
term.onData((data) => {
sendFunction(data);
});
term.onBinary((data) => {
const buffer = new Uint8Array(data.length);
for (let i = 0; i < data.length; ++i) {
buffer[i] = data.charCodeAt(i) & 255;
}
sendFunction(buffer);
});
}
|