X-Git-Url: http://git.scottworley.com/vopamoi/blobdiff_plain/e88c099c05a14bc0851cbab622938cdd4e8c6cc9..06ee32a10fa00f28eaae8a6f7e948b422e1861cd:/vopamoi.ts?ds=sidebyside diff --git a/vopamoi.ts b/vopamoi.ts index 654a7a8..ab58d6d 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -75,14 +75,16 @@ const UI = { }, }; +function focusTaskNameInput(event: any) { + document.getElementById("taskName")!.focus(); + event.preventDefault(); +} + function handleKey(event: any) { if (event.target.tagName !== "INPUT") { - if (event.key == "j") Model.moveCursor(1); - if (event.key == "k") Model.moveCursor(-1); - if (event.key == "c") { - document.getElementById("taskName")!.focus(); - event.preventDefault(); - } + if (event.key == "j") return Model.moveCursor(1); + if (event.key == "k") return Model.moveCursor(-1); + if (event.key == "c") return focusTaskNameInput(event); } }