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