Send console text slower to avoid overloading remote keyboard buffer (#254)

Co-authored-by: Marcus Sorensen <mls@apple.com>
This commit is contained in:
Marcus Sorensen 2023-05-08 00:23:00 -06:00 committed by GitHub
parent 9ca42f118a
commit 189efabc85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 13 deletions

View File

@ -433,21 +433,30 @@ export default class RFB extends EventTargetMixin {
this._resumeAuthentication();
}
sendText(text) {
for (var i = 0; i < text.length; i++) {
const character = text.charAt(i);
var charCode = USKeyTable[character] || false;
if (charCode) {
this.sendKey(charCode, character, true);
this.sendKey(charCode, character, false);
} else {
charCode = text.charCodeAt(i)
this.sendKey(KeyTable.XK_Shift_L, "ShiftLeft", true);
this.sendKey(charCode, character, true);
this.sendKey(charCode, character, false);
this.sendKey(KeyTable.XK_Shift_L, "ShiftLeft", false);
sendText(text) {
const sleep = (time) => {
return new Promise(resolve => setTimeout(resolve, time))
}
const keyboardTypeText = async () => {
for (var i = 0; i < text.length; i++) {
const character = text.charAt(i);
var charCode = USKeyTable[character] || false;
if (charCode) {
this.sendKey(charCode, character, true);
this.sendKey(charCode, character, false);
} else {
charCode = text.charCodeAt(i)
this.sendKey(KeyTable.XK_Shift_L, "ShiftLeft", true);
this.sendKey(charCode, character, true);
this.sendKey(charCode, character, false);
this.sendKey(KeyTable.XK_Shift_L, "ShiftLeft", false);
}
await sleep(25)
}
}
keyboardTypeText()
}
sendCtrlAltDel() {