weak cursor
This commit is contained in:
parent
da7c3ceae1
commit
b1570a1ea1
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user