summaryrefslogtreecommitdiff
path: root/core/mouse.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/mouse.zig')
-rw-r--r--core/mouse.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/mouse.zig b/core/mouse.zig
index feb5ac08..9f0cfd8b 100644
--- a/core/mouse.zig
+++ b/core/mouse.zig
@@ -877,6 +877,13 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void {
pane.scrollBy(p.settings.tab, if (m.button == config.look_button) local else -local);
} else if (edit.pointerTextSelection(p, id, mcol, mrow, m.body_hit, v.pointer_tag_hit)) |pointed| {
if (m.button == config.look_button) v.active = id;
+ // A word of a message's detail, read as it is drawn:
+ // run or looked at as a typed one would be.
+ if (pointed.ghost) |row| {
+ const arena = p.scratch.allocator();
+ const word = (body_layer.wordAt(p, arena, id, row, @intCast(@max(0, pointed.sel.c0))) catch return) orelse return;
+ return exec.runBuiltin(p, if (m.button == config.exec_button) config.exec_cmd else config.look_cmd, id, "", arena.dupe(u8, word) catch return);
+ }
pane.clearPointerSelection(@backingInt(m.button));
pane.sel[@backingInt(m.button)] = pointed.sel;
v.drag = .{
@@ -989,7 +996,7 @@ pub fn dragUpdate(p: *Pardes, mcol: u16, mrow: u16, body_hit: ?Mouse.BodyHit) vo
if (supplied.serial == pane.serial) s.body = supplied.place;
const mapped_hit = bodyHitForPane(p, s.id, supplied, true) orelse return;
pane.sel[b].c1 = @as(i32, mapped_hit.col) - config.GUTTER;
- pane.sel[b].r1 = @as(i32, mapped_hit.row) + tag_rows;
+ pane.sel[b].r1 = pane.textRow(mapped_hit.row) + tag_rows;
return;
};
// A sweep that began on the tag stays on it, on the tag line
@@ -1025,7 +1032,7 @@ pub fn dragUpdate(p: *Pardes, mcol: u16, mrow: u16, body_hit: ?Mouse.BodyHit) vo
else if (body_h == 0)
0
else
- @as(i32, @min(@max(mrow, body_y), body_y + body_h - 1)) - @as(i32, body_y) + tag_rows;
+ pane.textRow(@as(i32, @min(@max(mrow, body_y), body_y + body_h - 1)) - @as(i32, body_y)) + tag_rows;
if (pane.sel[b].r1 < tag_rows) pane.sel[b].c1 += @as(i32, pane.tag_scroll);
}
},