Fix glp backward cycle and gl<Space> current-list scope
CI / cargo fmt --check (push) Successful in 16s
CI / cargo clippy (push) Successful in 21s
CI / cargo test (push) Successful in 37s
CI / cargo fmt --check (pull_request) Successful in 34s
CI / cargo clippy (pull_request) Successful in 36s
CI / cargo test (pull_request) Successful in 38s
CI / editor keymaps (push) Successful in 1m23s
CI / editor keymaps (pull_request) Successful in 1m31s

Two documented checkbox-list mappings did not match their spec:

- `glp` dispatched the same forward-only cycleCheckbox as `gln`, so it
  could never "cycle the checkbox state backward". Add `ops::cycle_state_back`
  and thread a `reverse` flag through the dispatcher and both clients.

- `gl<Space>` and `gL<Space>` both swept the whole buffer, making them
  identical. `gl<Space>` now passes the cursor position and the server
  scopes deletion to the contiguous list block under the cursor (current
  list, cascading into sublists); `gL<Space>` stays whole-buffer.

Adds Rust unit tests, plus behavioral and full-registration coverage for
the documented mapping surface in the Neovim and Vim keymap harnesses, and
a command-coverage suite mirroring the doc's command groups.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 13:56:28 -03:00
parent 93725501dc
commit 21ac9deb23
12 changed files with 1016 additions and 25 deletions
@@ -47,6 +47,24 @@ fn cycle_state_walks_progression() {
assert_eq!(ops::cycle_state("[-]"), Some("[ ]"));
}
#[test]
fn cycle_state_back_is_exact_inverse() {
// `glp` walks the progression in reverse — every step must undo the
// matching `cycle_state` step.
assert_eq!(ops::cycle_state_back("[ ]"), Some("[X]"));
assert_eq!(ops::cycle_state_back("[X]"), Some("[O]"));
assert_eq!(ops::cycle_state_back("[O]"), Some("[o]"));
assert_eq!(ops::cycle_state_back("[o]"), Some("[.]"));
assert_eq!(ops::cycle_state_back("[.]"), Some("[ ]"));
assert_eq!(ops::cycle_state_back("[-]"), Some("[ ]"));
// Composing forward then backward returns to the start for every
// in-cycle marker.
for s in ["[ ]", "[.]", "[o]", "[O]", "[X]"] {
let fwd = ops::cycle_state(s).unwrap();
assert_eq!(ops::cycle_state_back(fwd), Some(s));
}
}
#[test]
fn reject_state_toggles_dash_marker() {
assert_eq!(ops::reject_state("[ ]"), Some("[-]"));