weak cursor
This commit is contained in:
parent
da7c3ceae1
commit
b1570a1ea1
|
|
@ -8,16 +8,11 @@ let cmdCursor: HTMLTextAreaElement
|
||||||
|
|
||||||
export function initCursor() {
|
export function initCursor() {
|
||||||
cmdCursor = $("command-cursor") as HTMLTextAreaElement
|
cmdCursor = $("command-cursor") as HTMLTextAreaElement
|
||||||
setCursor()
|
|
||||||
|
|
||||||
cmdInput.addEventListener("keydown", showCursor)
|
cmdInput.addEventListener("keydown", showCursor)
|
||||||
|
showCursor()
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCursor() {
|
function showCursor(e: KeyboardEvent | any = {}) {
|
||||||
cmdCursor.value = cmdCursor.value.endsWith(cursor) ? "" : " ".repeat(cmdInput.value.length) + cursor
|
|
||||||
}
|
|
||||||
|
|
||||||
function showCursor(e: any) {
|
|
||||||
if (e.key === "Enter" && !e.shiftKey) {
|
if (e.key === "Enter" && !e.shiftKey) {
|
||||||
cmdCursor.value = cursor
|
cmdCursor.value = cursor
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user