summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CHANGELOG.md3
-rw-r--r--src/mouse.zig10
-rw-r--r--src/pardes.zig8
3 files changed, 15 insertions, 6 deletions
diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md
index 7a46555c..fff21d83 100644
--- a/src/CHANGELOG.md
+++ b/src/CHANGELOG.md
@@ -22,6 +22,9 @@
/screen.
- A pane's `ctl` read ends with its mode, `mode:normal|insert|select|tty`,
and `kbdin` takes Plan 9's Kalt, Kshift and Kctl runes before a key.
+- A click on a tag, a column's or the workspace's puts its cursor there
+ in normal mode, where it put it in insert mode: `i` types there, Enter
+ or Tab runs the word under it.
- One `pardes --daemon` per user keeps sessions, started by the first
session and gone once it keeps nothing. `pardes` in a terminal forks
its session off and stays as its stub: `Detach` (`SPC s D`), or a
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;
diff --git a/src/pardes.zig b/src/pardes.zig
index b47119c4..b20fbb32 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -3081,11 +3081,15 @@ test "editable workspace and column tags are typed into and persist" {
p.update(.{ .mouse = .{ .button = .left, .kind = .drag, .col = TAG_TEXT_INSET + 6, .row = 0 } });
p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = TAG_TEXT_INSET + 6, .row = 0 } });
try std.testing.expect(p.global_tag.vsel.active and p.global_tag.vsel.col == 0 and p.global_tag.cur_col == 6);
- p.update(.{ .key = .{ .cp = 'H', .text = " Help" } });
+ // A clicked header is in normal mode: `a` types after the sweep's
+ // last character, the blank it ended on.
+ p.update(.{ .key = .{ .cp = 'a', .text = "a" } });
+ p.update(.{ .key = .{ .cp = 'H', .text = "Help " } });
try std.testing.expect(std.mem.startsWith(u8, p.global_tag.own.?, "Newcol Help Joincol"));
p.update(.{ .key = .{ .cp = Key.escape } });
p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = TAG_TEXT_INSET, .row = TOPBAR_H } });
p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = TAG_TEXT_INSET, .row = TOPBAR_H } });
+ p.update(.{ .key = .{ .cp = 'i', .text = "i" } });
p.update(.{ .key = .{ .cp = 'é', .text = "é" } });
try std.testing.expect(std.mem.startsWith(u8, tagline.columnTag(p, 0), "éNew"));
p.update(.{ .key = .{ .cp = Key.backspace } });
@@ -3136,6 +3140,8 @@ test "column tags render edit hover and scroll from the column edge" {
for (0..3) |offset|
try std.testing.expectEqual(Color{ .rgb = p.theme().sel_bg }, selected.at(x + @as(u16, @intCast(offset)), TOPBAR_H).style.bg);
p.update(.{ .key = .{ .cp = Key.home } });
+ // A clicked header is in normal mode: `i` types there.
+ p.update(.{ .key = .{ .cp = 'i', .text = "i" } });
p.update(.{ .key = .{ .cp = 'H', .text = "Help " } });
try std.testing.expect(std.mem.startsWith(u8, tagline.columnTag(p, column), "Help New Tty"));
const edited = try p.render(frame.allocator());