From 18c66ca7a91cc4ffff05b2ad554eba8d2e2156ca Mon Sep 17 00:00:00 2001 From: "J. Champagne" Date: Sat, 14 Mar 2026 13:56:22 -0400 Subject: [PATCH] doc: Remove ideas for marks and registers from plans. --- docs/DESIGN.md | 42 +++++++++++++++++++++++++++--------------- docs/DEVPLAN.md | 28 +++++++++++++++++----------- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/docs/DESIGN.md b/docs/DESIGN.md index d9bcbd3..dbaf364 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -80,7 +80,7 @@ There are two ways to respond to them: **exec hooks** and | `on-select` | User confirms (Enter) | Apply the choice | | `on-cancel` | User cancels (Escape) | Revert preview | | `on-filter` | Filter text changes | Dynamic item reloading | -| `on-mark` | User marks/unmarks an item | Visual feedback | +| `on-toggle` | User toggles an item's selection | Visual feedback (deferred) | ### Exec Hooks (fire-and-forget) @@ -383,16 +383,14 @@ designed. | `Ctrl+D` / `Ctrl+U` | Half-page down / up | | `Ctrl+F` / `Ctrl+B` | Full page down / up | | `/` | Enter filter (insert) mode | -| `n` / `N` | Next / previous filter match | -| `m{a-z}` | Set mark at current position | -| `'{a-z}` | Jump to mark | -| `"a` | Select into register `a` | -| `v` | Toggle multi-select on current item | -| `V` | Visual line select mode | +| `Space` | Toggle select + move down (`--multi`) | +| `V` | Enter visual line mode (`--multi`) | +| `u` | Undo last selection change (`--multi`) | +| `U` | Clear all selections (`--multi`) | +| `Ctrl+R` | Redo selection change (`--multi`) | | `Enter` | Confirm selection | | `Escape` | Cancel and exit | | `q` | Cancel and exit | -| `Space` | Toggle select current item and move down | `H`/`M`/`L` (viewport-relative jumps) are deferred. They're nice-to-have but not essential for the first pass of vim @@ -400,12 +398,26 @@ navigation. ### Multi-Select -- `Space` or `v` toggles selection on current item -- `V` enters visual line mode, moving up/down selects ranges -- All selected items are emitted on confirm -- `"a` through `"z`: select into named registers (like vim - yanking) -- Registers can be recalled or included in output +Requires `--multi` flag. Without it, toggle/select actions +are no-ops and confirm always returns a single item. + +- `Space` or `Tab` toggles selection on the cursor item and + moves down. `Shift+Tab` toggles and moves up. +- `V` enters visual line mode: `j`/`k` extend the range, + `Space`/`Enter` force-selects the range and returns to + normal mode, `V` cancels back to normal with no change. +- `u` undoes the last selection change, `Ctrl+R` redoes. + Undo/redo stacks track snapshots of the full selection set. +- `U` clears all selections (undoable). +- Selections survive filter changes. Toggling item "foo", + then filtering to something else, then confirming still + includes "foo" in the output. +- `--selection-order` flag: output items in the order they + were selected (insertion order) instead of the default + input order. +- Confirm with selections: outputs all selected items. + Confirm with no selections in multi mode: falls back to + the cursor item as a single-element result. ### Drill-Down @@ -479,7 +491,7 @@ A few built-in themes ship with pikl. `--theme monokai` or ## Sessions `--session name` persists the menu's state (filter text, -scroll position, selected items, marks, registers) across +scroll position, selections) across invocations. State lives in `~/.local/state/pikl/sessions/`. diff --git a/docs/DEVPLAN.md b/docs/DEVPLAN.md index 5b6bb9e..f4d3550 100644 --- a/docs/DEVPLAN.md +++ b/docs/DEVPLAN.md @@ -170,19 +170,26 @@ through hooks and structured I/O. A handler hook can receive hover events and emit commands to modify menu state. -## Phase 4: Multi-Select & Registers +## Phase 4: Multi-Select -Power selection features. +Selection with undo/redo. No marks or registers: filtering +already handles navigation, and selections surviving filter +changes covers the register use case. **Deliverables:** -- Space to toggle select, V for visual line mode -- Multi-select output (multiple JSON lines) -- Named registers (`"a` through `"z`) -- Marks (`m{a-z}`, `'{a-z}`) -- `--multi` flag to enable multi-select mode +- `--multi` flag to gate all multi-select behaviour +- `Space`/`Tab` toggle-select, `Shift+Tab` toggle-up +- `V` visual line mode (force-select ranges) +- `u`/`Ctrl+R` undo/redo selection changes, `U` clear all +- Selections survive filter changes (tracked by original index) +- `--selection-order` flag for insertion-order output +- Multi-item output: one JSON line per selected item +- Action-fd commands: toggle-select, select-all, deselect-all, + undo-selection, redo-selection +- Test DSL: `multi` fixture, `selected_items` assertion -**Done when:** You can select multiple items, store them -in registers, and get them all in the output. +**Done when:** `seq 1 20 | pikl --multi`, toggle a few items +with Space, confirm, and all selected items appear on stdout. ## Phase 5: Table Mode & CSV @@ -204,8 +211,7 @@ Persistence and external control. **Deliverables:** - `--session name` for state persistence -- Session state: filter, scroll position, selections, - marks, registers +- Session state: filter, scroll position, selections - Session history log file - Unix socket IPC while running - IPC commands: push/remove/update items, set filter,