summaryrefslogtreecommitdiff
path: root/src/mouse.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/mouse.zig')
-rw-r--r--src/mouse.zig11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/mouse.zig b/src/mouse.zig
index 76c65a16..eeb987b2 100644
--- a/src/mouse.zig
+++ b/src/mouse.zig
@@ -1114,7 +1114,9 @@ fn mirrorTtySelection(p: *Pardes, pane: *Pane) void {
/// second selects what edit.doubleClickRange says, from the caret the click
/// left. A plain click still puts the caret on its cell.
fn doubleClick(p: *Pardes, id: usize, t: *panes.Text, on_tag: bool, row: i32, col: i32) void {
- const now = clockMs();
+ // The host's clock, which every host keeps (a libc clock is no clock on
+ // the web or the board) and a test's virtual one replaces.
+ const now: i64 = @intCast(p.now_ns / std.time.ns_per_ms);
const prev = p.last_click;
p.last_click = .{ .id = id, .on_tag = on_tag, .row = row, .col = col, .ms = now };
const c = prev orelse return;
@@ -1160,13 +1162,6 @@ fn sweepPoint(p: *Pardes, pane: *panes.Pane, r: i32, c: i32) ?modal.Cursor {
return .{ .row = @intCast(w.line), .col = @intCast(@max(0, col)) };
}
-fn clockMs() i64 {
- if (comptime !pardes.hosted) return 0;
- var ts: std.c.timespec = undefined;
- if (std.c.clock_gettime(.MONOTONIC, &ts) != 0) return 0;
- return @as(i64, ts.sec) * 1000 + @divTrunc(@as(i64, ts.nsec), 1_000_000);
-}
-
fn dragRelease(p: *Pardes, button: Mouse.Button) void {
// A different button's release belongs to a chord or another host
// stream; only the button which began this gesture may end it.