bugs i think
This commit is contained in:
parent
6cc547121c
commit
c8157f53b1
42
ime.js
42
ime.js
@ -90,18 +90,17 @@ class HeonianIME {
|
||||
//close enough?
|
||||
}
|
||||
|
||||
imePush() {
|
||||
imePush(space = false) {
|
||||
//basically equavlient to pressing enter.
|
||||
if (this.selected == -1) {
|
||||
if (this.currentWord.join() == "") { //blame js :)
|
||||
let s = document.createElement("p");
|
||||
s.innerText = this.input.join("");
|
||||
document.body.appendChild(s);
|
||||
this.input = [];
|
||||
this.selected = -1;
|
||||
} else {
|
||||
if (this.currentWord.join() != "") { //blame js :)
|
||||
this.input.push(this.currentWord);
|
||||
this.currentWord = [];
|
||||
if (space == true) {
|
||||
this.currentWord = [" "];
|
||||
this.input.push(this.currentWord);
|
||||
this.currentWord = [];
|
||||
}
|
||||
}
|
||||
this.imeReset();
|
||||
} else {
|
||||
@ -110,14 +109,17 @@ class HeonianIME {
|
||||
} else {
|
||||
this.selected += 1;
|
||||
}
|
||||
if (space == true) {
|
||||
this.input.splice(this.selected, 0, [" "]);
|
||||
}
|
||||
this.imeReset(true);
|
||||
}
|
||||
}
|
||||
|
||||
imeDown(keyEvent, inputField) {
|
||||
keyEvent.preventDefault();
|
||||
switch (keyEvent.key) {
|
||||
case "Backspace":
|
||||
switch (keyEvent.keyCode) {
|
||||
case 8:
|
||||
if (this.selected == -1) {
|
||||
if (this.currentWord.join("") == "") {
|
||||
this.currentWord = this.input.pop() || [];
|
||||
@ -134,25 +136,25 @@ class HeonianIME {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "Enter":
|
||||
case 13:
|
||||
this.imePush()
|
||||
break;
|
||||
case "Space":
|
||||
//TODO LMAO
|
||||
case 32:
|
||||
this.imePush(true);
|
||||
break;
|
||||
case "ArrowLeft":
|
||||
case 37:
|
||||
this.imeMove("left");
|
||||
break;
|
||||
case "ArrowRight":
|
||||
case 39:
|
||||
this.imeMove("right");
|
||||
break;
|
||||
case "ArrowDown":
|
||||
case 40:
|
||||
this.imeMove("start");
|
||||
break;
|
||||
case "ArrowUp":
|
||||
case 38:
|
||||
this.imeMove("end");
|
||||
break;
|
||||
case "Escape":
|
||||
case 27:
|
||||
this.imeDetach();
|
||||
return;
|
||||
default:
|
||||
@ -312,6 +314,10 @@ class HeonianIME {
|
||||
// ari fell asleep
|
||||
|
||||
imeRestore(array) {
|
||||
if (array.join("") == " ") {
|
||||
this.imeChange(0,0,true,array);
|
||||
return;
|
||||
}
|
||||
let hex = array[array.length - 1].codePointAt(0).toString(16).split("");
|
||||
hex[1] = hex[1].toString(16);//parseInt(hex[1], 16);
|
||||
hex[2] = hex[2].toString(16);//parseInt(hex[2], 16);
|
||||
|
Loading…
Reference in New Issue
Block a user