docs(command): move command/keymap.rs and cmd/** arguments to context/
keymap.rs: the dispatch/registry-vs-table split (this file stays the authority on it) and the improvise-0hb Sequence-flattening decline, with its three findings. cmd/**: the two CommitAndAdvance orderings, CommitSave's mode-change-first, add_category's deliberate no-coordinate-write, EditOrDrill's mode-agnostic message choice, the SaveAndQuit and CreateAndSwitchView declines, and fit.rs's whole module doc including the measured wasm bundle cost. crates/improvise-command now reports no comment run over two lines. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
//! Import-wizard key handling.
|
||||
//!
|
||||
//! The wizard is a small step machine, and which key means what depends on
|
||||
//! the step it is in. That decision is pure, so it lives here: the command
|
||||
//! reads the wizard out of `CmdContext` and emits the discrete effects
|
||||
//! (`WizardApply`, `CloseWizard`, `AcceptWizardModel`) that carry it out
|
||||
//! (improvise-2wm).
|
||||
//! Import-wizard key handling: which key means what depends on the step, and that
|
||||
//! decision is pure, so it lives here (improvise-2wm, gotcha 22).
|
||||
|
||||
|
||||
use crate::command::key::KeyCode;
|
||||
use crate::import::wizard::{ImportWizard, WizardStep};
|
||||
@@ -102,9 +98,8 @@ fn name_model_keys(key: KeyCode) -> Vec<Box<dyn Effect>> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The confirmation step: the workbook is built and waiting. Enter installs
|
||||
/// it, and both Esc and Left return to `NameModel` — unlike every other
|
||||
/// step, Esc here does not throw the import away (improvise-907).
|
||||
/// The confirmation step: Enter installs the built workbook, and both Esc and Left
|
||||
/// return to `NameModel` — Esc here does not discard the import (improvise-907).
|
||||
fn done_keys(key: KeyCode) -> Vec<Box<dyn Effect>> {
|
||||
match key {
|
||||
KeyCode::Enter => vec![Box::new(effect::AcceptWizardModel)],
|
||||
@@ -123,9 +118,8 @@ fn cursor_keys(key: KeyCode) -> Vec<Box<dyn Effect>> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Left steps back to the previous step, on every step. It is the one key
|
||||
/// free everywhere — Backspace edits the name and the formula buffer, and
|
||||
/// `h` is a printable character the name step needs (improvise-907).
|
||||
/// Left steps back on every step. It is the one key free everywhere: Backspace edits
|
||||
/// buffers and `h` is a printable the name step needs (improvise-907).
|
||||
fn back_key(key: KeyCode) -> Vec<Box<dyn Effect>> {
|
||||
match key {
|
||||
KeyCode::Left => op(WizardOp::Back),
|
||||
@@ -202,9 +196,8 @@ mod tests {
|
||||
assert!(ops(&w, KeyCode::Enter).contains("ConfirmFormula"));
|
||||
}
|
||||
|
||||
/// Enter on the name step builds the workbook into the wizard rather
|
||||
/// than advancing the step machine; every other printable key edits the
|
||||
/// name.
|
||||
/// Enter on the name step builds the workbook rather than advancing the step
|
||||
/// machine; every other printable key edits the name.
|
||||
#[test]
|
||||
fn name_model_enter_builds_the_model() {
|
||||
let w = wizard_at(WizardStep::NameModel);
|
||||
@@ -234,9 +227,8 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// On the confirmation step Enter installs the built workbook and Esc
|
||||
/// steps back — it does not throw the import away, and no key closes
|
||||
/// the wizard outright (improvise-907, from improvise-c6j).
|
||||
/// On the confirmation step Enter installs the built workbook and Esc steps back;
|
||||
/// no key closes the wizard outright (improvise-907, from improvise-c6j).
|
||||
#[test]
|
||||
fn done_confirms_on_enter_and_steps_back_on_esc() {
|
||||
let w = wizard_at(WizardStep::Done);
|
||||
|
||||
Reference in New Issue
Block a user