summaryrefslogtreecommitdiff
path: root/core/keys.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/keys.zig')
-rw-r--r--core/keys.zig16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/keys.zig b/core/keys.zig
index 05349d59..61ebaab9 100644
--- a/core/keys.zig
+++ b/core/keys.zig
@@ -197,6 +197,13 @@ pub fn handleKey(p: *Pardes, key: Key) void {
// A root this key strikes starts its which-key delay; one it ends
// takes its level away (TagState).
defer TagState.follow(p);
+ // A key that moves the keyboard to the pane a waiting state hangs
+ // under (`C-w`'s pick, `SPC w k`) gives the state the keyboard back (UX
+ // DESIGN O2).
+ const keyboard = p.view().active;
+ defer if (p.view().tag_state.waits and p.view().window_pick == null and p.view().active != keyboard and TagState.hostOf(p) == p.view().active) {
+ p.view().tag_state.waits = false;
+ };
// A double-click is two clicks with nothing between them.
p.view().last_click = null;
if (p.macro.recording != 0 and p.macro.replaying == 0) Macro.append(&p.macro.recorded, p.gpa, key) catch |err| p.reportError(.at(p.view().active), "macro", err);
@@ -229,8 +236,13 @@ pub fn handleKey(p: *Pardes, key: Key) void {
return;
}
p.view().answering = 0;
- // A tag in a typing state takes every key (TagState: Help, describe-key).
- if (p.view().tag_state.kind != .rest) return tagStateKey(p, key);
+ // A tag in a typing state takes every key (TagState: Help, describe-key);
+ // one waiting for the keyboard (UX DESIGN O2) only Esc, which ends it
+ // first: the others go where the keyboard is.
+ if (p.view().tag_state.kind != .rest) {
+ if (!p.view().tag_state.waits) return tagStateKey(p, key);
+ if (hit(key, config.escape)) return TagState.toRest(p);
+ }
Prompt.keyAtRest(p, key);
@import("Pick.zig").keyAtRest(p, key);
// Esc takes a hover's ghost lines away (SPEC ยง3.5) before anything else