diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-24 13:48:41 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-24 15:41:50 -0300 |
| commit | 32fd7e0cd8b472573cc9e2d49934245fb279d412 (patch) | |
| tree | 9aefab38150184e4c64aa5b8dc4ed13461617f85 /docs/next-winmode.md | |
| parent | 578710b72755503ef2ef40a0ae301e608af3e3af (diff) | |
| download | pardes-32fd7e0cd8b472573cc9e2d49934245fb279d412.tar.gz pardes-32fd7e0cd8b472573cc9e2d49934245fb279d412.zip | |
Docs for window mode's d and c and the delayed Del hint: Help, cheatsheet, guide, reference, tutor, helix-keys
Diffstat (limited to 'docs/next-winmode.md')
| -rw-r--r-- | docs/next-winmode.md | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/docs/next-winmode.md b/docs/next-winmode.md new file mode 100644 index 00000000..c2a01da8 --- /dev/null +++ b/docs/next-winmode.md @@ -0,0 +1,69 @@ +# winmode: d and c in window mode, the Del question as a hint + +> The window mode should have d for deleting and c for collapsing too, the +> deletion should keep that j/k movement. The current spc d j/k should only +> show the message after a timeout so that a user that does this fast won't +> even see it, it will be more like a hint for users that tried to delete +> and nothing happenend. + +## As built + +- `layout.windowKey`: `c` runs `Collapse` on the outlined pane; `d` makes + the outlined pane active and runs `Del` on it, exactly the keyboard Del + (`can_ask` is set: it is a key). With panes above and below, Del asks + and the next key is its answer (`Pardes.answerQuestion`, which already + runs before window mode sees keys); with one neighbour it closes at once. + Either way, once the pane is gone the outline moves to `p.active`, which + `removePane` already sets to the pane that grew into the rows. The mode + stays on: `Ctrl-w d j d` closes two panes. A refused Del (unsaved text) + leaves the outline where it is, the refusal on the message row. +- Keys: `config.window_delete` (`d`) and `config.window_collapse` (`c`), + apart from `window_keys`, because those are also the header walk under + `Ctrl-w` on a tag, where `d`/`c` mean nothing. +- Labels: `layout.window_labels` loses `d` and `c` (22 -> 20 letters). +- The hint: Del sets `Pane.question_due_ns = clock + 400 ms` when it asks; + `Messages.collectNotices` leaves the prompt band out while + `question_due_ns > now_ns`; `nextWake` wakes once at that time (while + `question_due_ns > stepped_ns`, so stepping past it ends the wake and a + tick draws the frame). Same pattern as the REPL's `repl_enter_due_ns`. + The question exists from the first moment: keys answer it, the 9P log + says `ask` at once, a script's `answer` works; only the band waits. + +## Why 400 ms + +Typed in one go, the `j` after `SPC d` lands 100-250 ms after the `d` +(a leader sequence's inter-key gap). Above ~300 ms it is a pause, the hand +waiting to see something happen. 400 ms clears a relaxed typist with margin +and is still quick enough to read as "it is asking", not "it is broken". +Key-hint popups elsewhere (which-key) wait a few hundred ms for the same reason. It is a compile-time +constant beside `del_question` (keys are compiled in); a Runtime setting +would be one line in config if the author wants to tune it live. + +## Tests + +- `window mode d deletes the outlined pane and asks k or j, c collapses + it, and the mode stays` (pardes.zig): c twice restores the height; d asks, + Esc keeps it, d j gives the rows below and the outline follows; d with one + neighbour closes at once onto it; labels hold none of h j k l d c. +- `the Del question shows only once its delay is up: a quick SPC d j never + sees it`: no prompt band before the due time, nextWake at it and not + past one frame, the band after, no wake once stepped past; a fast + `SPC d j` closes with the band never showing it. +- The old Del test moves the clock to the due time before looking at the + band. `test/snapshots/delask.snap` waits out the delay (`settle 700`) + before `snap asked`; its golden is unchanged (it raced otherwise: the + first `stable 400` saw no change and captured the band empty). + +## Open questions, positions + +- Should `d` leave window mode after closing? Position: no. The point of a + mode is a run of layout edits (`Ctrl-w d j d c`), and the outline landing + on the pane that grew says where you are; Enter/Esc end it as ever. +- `d`/`c` taken from the labels: the 21st and 22nd panes lose a letter. + Position: fine; past 20 panes you move anyway. The alternative (labels + only after a prefix) costs a key on every jump. +- Del's question from a click or 9P never asks, so the delay touches only + the keyboard paths that ask today. +- Pushback: the hint could be the message row's own lingering text instead + of the prompt band, but the band is where the answer's keys are named and + the caret logic already knows it; kept. |
