aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/terminal/c/selection_gesture.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/terminal/c/selection_gesture.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/terminal/c/selection_gesture.zig')
-rw-r--r--vendor/libghostty-vt/src/terminal/c/selection_gesture.zig66
1 files changed, 34 insertions, 32 deletions
diff --git a/vendor/libghostty-vt/src/terminal/c/selection_gesture.zig b/vendor/libghostty-vt/src/terminal/c/selection_gesture.zig
index cc56da3c..46253057 100644
--- a/vendor/libghostty-vt/src/terminal/c/selection_gesture.zig
+++ b/vendor/libghostty-vt/src/terminal/c/selection_gesture.zig
@@ -241,7 +241,7 @@ pub fn event_new(
event_type: EventType,
) callconv(lib.calling_conv) Result {
const out = out_event orelse return .invalid_value;
- _ = std.meta.intToEnum(EventType, @intFromEnum(event_type)) catch
+ _ = std.enums.fromInt(EventType, @intFromEnum(event_type)) orelse
return .invalid_value;
const alloc = lib.alloc.default(alloc_);
@@ -343,7 +343,7 @@ pub fn event_set(
value: ?*const anyopaque,
) callconv(lib.calling_conv) Result {
if (comptime std.debug.runtime_safety) {
- _ = std.meta.intToEnum(EventOption, @intFromEnum(option)) catch {
+ _ = std.enums.fromInt(EventOption, @intFromEnum(option)) orelse {
log.warn("selection_gesture_event_set invalid option value={d}", .{@intFromEnum(option)});
return .invalid_value;
};
@@ -365,7 +365,7 @@ pub fn get(
out: ?*anyopaque,
) callconv(lib.calling_conv) Result {
if (comptime std.debug.runtime_safety) {
- _ = std.meta.intToEnum(Data, @intFromEnum(data)) catch {
+ _ = std.enums.fromInt(Data, @intFromEnum(data)) orelse {
log.warn("selection_gesture_get invalid data value={d}", .{@intFromEnum(data)});
return .invalid_value;
};
@@ -738,24 +738,12 @@ fn clearWordBoundaryCodepoints(event: *EventWrapper, target: *[]const u21) void
target.* = &selection_codepoints.default_word_boundaries;
}
-fn instantFromNs(ns: u64) SelectionGesture.Time {
- if (comptime builtin.target.cpu.arch == .wasm32 and
- builtin.target.os.tag == .freestanding)
- {
- return ns;
- }
-
- return switch (builtin.os.tag) {
- .windows, .uefi, .wasi => .{ .timestamp = ns },
- else => .{ .timestamp = .{
- .sec = @intCast(ns / std.time.ns_per_s),
- .nsec = @intCast(ns % std.time.ns_per_s),
- } },
- };
+fn instantFromNs(ns: u64) std.Io.Timestamp {
+ return .fromNanoseconds(ns);
}
fn validBehavior(behavior: Behavior) bool {
- _ = std.meta.intToEnum(Behavior, @intFromEnum(behavior)) catch return false;
+ _ = std.enums.fromInt(Behavior, @intFromEnum(behavior)) orelse return false;
return true;
}
@@ -764,7 +752,8 @@ test "selection gesture lifecycle and get" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -800,7 +789,8 @@ test "selection gesture get_multi" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -844,7 +834,8 @@ test "selection gesture get_multi returns first failing index" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -956,7 +947,8 @@ test "selection gesture event applies press" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1003,7 +995,8 @@ test "selection gesture event press requires ref" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1031,7 +1024,8 @@ test "selection gesture event null output still reports no selection" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1065,7 +1059,8 @@ test "selection gesture event applies release" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1116,7 +1111,8 @@ test "selection gesture release without ref marks dragged" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1163,7 +1159,8 @@ test "selection gesture event applies drag" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1235,7 +1232,8 @@ test "selection gesture drag requires ref and geometry" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1279,7 +1277,8 @@ test "selection gesture event applies autoscroll tick" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1362,7 +1361,8 @@ test "selection gesture autoscroll tick requires viewport and geometry" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1401,7 +1401,8 @@ test "selection gesture event applies deep press" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);
@@ -1456,7 +1457,8 @@ test "selection gesture deep press without active anchor returns no value" {
try testing.expectEqual(Result.success, terminal_c.new(
&lib.alloc.test_allocator,
&terminal,
- .{ .cols = 5, .rows = 2, .max_scrollback = 10_000 },
+ 5,
+ 2,
));
defer terminal_c.free(terminal);