diff --git a/src/js/cursor.ts b/src/js/cursor.ts index 01471ce..471566e 100644 --- a/src/js/cursor.ts +++ b/src/js/cursor.ts @@ -8,16 +8,11 @@ let cmdCursor: HTMLTextAreaElement export function initCursor() { cmdCursor = $("command-cursor") as HTMLTextAreaElement - setCursor() - cmdInput.addEventListener("keydown", showCursor) + showCursor() } -function setCursor() { - cmdCursor.value = cmdCursor.value.endsWith(cursor) ? "" : " ".repeat(cmdInput.value.length) + cursor -} - -function showCursor(e: any) { +function showCursor(e: KeyboardEvent | any = {}) { if (e.key === "Enter" && !e.shiftKey) { cmdCursor.value = cursor return