From 5752e5c94f27eced137f4ca061c68715d8b7131a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 10:56:51 -0300 Subject: mouse: a click on a tag, a pane's, a column's or the workspace's, puts its cursor there in normal mode, where it was insert mode (the user's): a letter is a command, `i` types where it was clicked, Enter or Tab runs the word under it; the guide, the cheatsheet and the changelog say so; the tests that clicked a tag and typed now type `i` (or `a` after a sweep) first, and an Esc that left insert mode goes; snap: nine scripts likewise, layout-close's golden now the Del its chord was meant to run (the click had typed ` dk` into the tag); a behavioural test, checked to fail with insert mode back Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/mouse.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mouse.zig') diff --git a/src/mouse.zig b/src/mouse.zig index b7307f2d..c1ea598d 100644 --- a/src/mouse.zig +++ b/src/mouse.zig @@ -657,9 +657,9 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { if (m.button == config.select_button) { const t = point.t; const at = point.at - modal.lineStartOffset(point.text, point.line); - // A clicked header is typed straight into, as a clicked tag is. + // A clicked header starts in normal mode, as a clicked tag does. if (!(p.header_focus and p.header_column == column)) tagline.enterHeader(p, column); - t.mode = .insert; + t.mode = .normal; t.cur_row = point.line; t.cur_col = @intCast(at); t.vsel = .{ .active = false, .row = point.line, .col = @intCast(at) }; @@ -797,13 +797,13 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { const pointed = edit.pointerTextSelection(p, id, mcol, mrow, m.body_hit, p.pointer_tag_hit) orelse return; pane.clearPointerSelection(sel_slot); pane.sel[sel_slot] = pointed.sel; - // A clicked tag is typed straight into, from where it was - // clicked; `:` is the door to its normal mode. + // A clicked tag starts in normal mode, its cursor where it + // was clicked: `i` or `a` types there. pane.focus = if (on_tag) .tag else .body; if (on_tag) { // a count typed before the click was meant for the body pane.body.normal.clear(); - pane.tag.mode = .insert; + pane.tag.mode = .normal; pane.tag.normal.clear(); pane.tag.vsel.active = false; pane.tag.msel.active = false; -- cgit v1.3