- 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 == "K") return BrowserUI.moveTask(-1);
- if (event.key == "n") return BrowserUI.focusTaskNameInput(event);
- if (event.key == "s") return BrowserUI.setState("someday-maybe");
- if (event.key == "w") return BrowserUI.setState("waiting");
- if (event.key == "d") return BrowserUI.setState("done");
- if (event.key == "c") return BrowserUI.setState("cancelled");
- if (event.key == "X") return BrowserUI.setState("deleted");
- if (event.key == "u") return BrowserUI.undo();
+ if (inputState === InputState.Command) {
+ 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 == "K") return browserUI.moveTask(-1);
+ if (event.key == "n") return browserUI.focusTaskNameInput(event);
+ if (event.key == "c") return browserUI.setState("cancelled");
+ if (event.key == "d") return browserUI.setState("done");
+ if (event.key == "s") return browserUI.setState("someday-maybe");
+ if (event.key == "t") return browserUI.setState("todo");
+ if (event.key == "w") return browserUI.setState("waiting");
+ if (event.key == "X") return browserUI.setState("deleted");
+ if (event.key == "u") return browserUI.undo();
+ if (event.key == "e") return browserUI.beginEdit(event);
+ if (event.key == "v") return (inputState = InputState.View);
+ } else if (inputState === InputState.View) {
+ inputState = InputState.Command;
+ if (event.key == "c") return browserUI.setView("cancelled");
+ if (event.key == "d") return browserUI.setView("done");
+ if (event.key == "s") return browserUI.setView("someday-maybe");
+ if (event.key == "t") return browserUI.setView("todo");
+ if (event.key == "w") return browserUI.setView("waiting");
+ if (event.key == "x") return browserUI.setView("deleted");
+ }