From 02c8a409c4aac79c5f0d2cc34ffba182198126a0 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 27 Jan 2022 22:21:06 -0800 Subject: [PATCH] Rename inputStates to be less semantic and more concrete --- vopamoi.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vopamoi.ts b/vopamoi.ts index 83354a4..50b25fa 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -451,10 +451,10 @@ function BrowserUI() { const browserUI = BrowserUI(); enum InputState { - Command, - View, + Root, + V, } -var inputState = InputState.Command; +var inputState = InputState.Root; function handleKey(event: any) { if (event.target.tagName === "INPUT") { @@ -469,7 +469,7 @@ function handleKey(event: any) { if (event.key == "Escape") return browserUI.completeEdit(event, CommitOrAbort.Abort); } } else { - if (inputState === InputState.Command) { + if (inputState === InputState.Root) { if (event.key == "j") return browserUI.moveCursor(1); if (event.key == "k") return browserUI.moveCursor(-1); if (event.key == "J") return browserUI.moveTask(1); @@ -486,9 +486,9 @@ function handleKey(event: any) { if (event.key == "u") return browserUI.undo(); if (event.key == "e") return browserUI.beginEdit(event); if (event.key == "t") return browserUI.beginTagEdit(event); - if (event.key == "v") return (inputState = InputState.View); - } else if (inputState === InputState.View) { - inputState = InputState.Command; + if (event.key == "v") return (inputState = InputState.V); + } else if (inputState === InputState.V) { + inputState = InputState.Root; if (event.key == "c") return browserUI.setView("cancelled", "Red"); if (event.key == "d") return browserUI.setView("done", "LawnGreen"); if (event.key == "q") return browserUI.setView("todo", "White"); -- 2.44.1