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") {
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);
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");