From d266ff2b816163ec9d09ec7ab79955b8fce719b0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 24 Nov 2026 22:32:26 -0300 Subject: mouse: a click that gives the keyboard to another pane ends a tag's level or typing state as Esc does (item 6 of A2, the coordinator's ruling on SPEC §3.4.6: only the pane with the keyboard leaves rest): a level (SPC's, a helix prefix's once shown, C-w's), Help or describe-key stayed out of rest when a click moved the keyboard, and followed it into the other pane's tag (the leader case had to press Esc after its struck key for that); now handleMouse notes the pane out of rest (TagState.hostOf) and, when the event leaves the keyboard on another pane, puts that pane's tag at rest as Esc does (TagState.toRest on it: its text's prefix too; the pane the click went to keeps its own); a click in the band or in the level's own tag keeps it; TEST FIRST: TagState.zig "a click that gives the keyboard to another pane ends a level as Esc does; one in the level's own tag keeps it" (failed before at the click into the other pane's body: the leader still current) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- core/mouse.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/mouse.zig') diff --git a/core/mouse.zig b/core/mouse.zig index 7a918883..3ed4ce48 100644 --- a/core/mouse.zig +++ b/core/mouse.zig @@ -499,6 +499,17 @@ fn chordCutPaste(p: *Pardes, cut: bool) edit.Error!void { pub fn handleMouse(p: *Pardes, event: Mouse) void { const v = p.view(); + // A click that gives the keyboard to another pane ends the level or + // typing state of the tag out of rest as Esc does, its text's prefix + // with it (SPEC §3.4.6: only the pane with the keyboard leaves rest); + // one in its band or its own tag keeps it. + const host = pardes.TagState.hostOf(p); + defer if (host) |was| if (v.active != was) { + const to = v.active; + v.active = was; + pardes.TagState.toRest(p); + v.active = to; + }; var m = event; // A click goes somewhere else: the question it leaves unanswered is // taken back, and the pane stays. A wheel only looks around. -- cgit v1.3