Skip to content

Commit

Permalink
style: replace tabs by spaces (GitSquared#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Stay authored Aug 14, 2021
1 parent 27c9c86 commit f0dfdc4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/classes/keyboard.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class Keyboard {
e.preventDefault();
for (let i = 0; i < e.changedTouches.length; i++) {
let key = e.changedTouches[i].target.parentElement;
if (key.tagName === 'svg') key = key.parentElement;
if (key.tagName === 'svg') key = key.parentElement;
if (key.getAttribute("class").startsWith("keyboard_key")) {
key.setAttribute("class", key.getAttribute("class")+" active");
key.onmousedown({preventDefault: () => {return true}});
Expand All @@ -238,7 +238,7 @@ class Keyboard {
e.preventDefault();
for (let i = 0; i < e.changedTouches.length; i++) {
let key = e.changedTouches[i].target.parentElement;
if (key.tagName === 'svg') key = key.parentElement;
if (key.tagName === 'svg') key = key.parentElement;
if (key.getAttribute("class").startsWith("keyboard_key")) {
key.setAttribute("class", key.getAttribute("class").replace("active", ""));
key.onmouseup({preventDefault: () => {return true}});
Expand Down Expand Up @@ -324,7 +324,7 @@ class Keyboard {
if (e.key === "Control" && e.getModifierState("AltGraph")) return;

// See #440
if (e.code === "ControlLeft" || e.code === "ControlRight") this.container.dataset.isCtrlOn = false;
if (e.code === "ControlLeft" || e.code === "ControlRight") this.container.dataset.isCtrlOn = false;
if (e.code === "ShiftLeft" || e.code === "ShiftRight") this.container.dataset.isShiftOn = false;
if (e.code === "AltLeft" || e.code === "AltRight") this.container.dataset.isAltOn = false;

Expand Down Expand Up @@ -520,20 +520,20 @@ class Keyboard {
window.term[window.currentTerm].writelr("");
} else {
document.activeElement.dispatchEvent(new CustomEvent("change", {detail: "enter" }));
}
}
return true;
}


if (window.keyboard.linkedToTerm) {
window.term[window.currentTerm].write(cmd);
} else {
let isDelete = false;
let isDelete = false;
if (typeof document.activeElement.value !== "undefined") {
switch(cmd) {
case "":
document.activeElement.value = document.activeElement.value.slice(0, -1);
isDelete = true;
isDelete = true;
break;
case "OD":
document.activeElement.selectionStart--;
Expand All @@ -551,8 +551,8 @@ class Keyboard {
}
}
}
// Emulate oninput events
document.activeElement.dispatchEvent(new CustomEvent("input", {detail: ((isDelete)? "delete" : "insert") }));
// Emulate oninput events
document.activeElement.dispatchEvent(new CustomEvent("input", {detail: ((isDelete)? "delete" : "insert") }));
document.activeElement.focus();
}
}
Expand Down

0 comments on commit f0dfdc4

Please sign in to comment.