weak cursor

This commit is contained in:
Chris Wanstrath 2025-09-21 14:21:46 -07:00
parent da7c3ceae1
commit b1570a1ea1

View File

@ -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