aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/terminal/c/cell.zig
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-07 18:29:21 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-07 18:29:21 +0300
commitdcfe11a7588fcd42471159453810abc9b7720a57 (patch)
treec32a77266028e73ca2382b96c96f8438a5fcd621 /vendor/libghostty-vt/src/terminal/c/cell.zig
parent2dfed860103c4e4505ac7f25def9fe37da1e1e6a (diff)
build: update libghostty-vt vendor
vendor ghostty 063ac3e and remove the musl libc++ link workaround. expose the new selection formatter and hyperlink uri apis for follow-up rendering work. add manual artifact validation for static linux builds.
Diffstat (limited to 'vendor/libghostty-vt/src/terminal/c/cell.zig')
-rw-r--r--vendor/libghostty-vt/src/terminal/c/cell.zig60
1 files changed, 60 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/terminal/c/cell.zig b/vendor/libghostty-vt/src/terminal/c/cell.zig
index c9746da7..b59567df 100644
--- a/vendor/libghostty-vt/src/terminal/c/cell.zig
+++ b/vendor/libghostty-vt/src/terminal/c/cell.zig
@@ -120,6 +120,27 @@ pub fn get(
};
}
+pub fn get_multi(
+ cell_: CCell,
+ count: usize,
+ keys: ?[*]const CellData,
+ values: ?[*]?*anyopaque,
+ out_written: ?*usize,
+) callconv(lib.calling_conv) Result {
+ const k = keys orelse return .invalid_value;
+ const v = values orelse return .invalid_value;
+
+ for (0..count) |i| {
+ const result = get(cell_, k[i], v[i]);
+ if (result != .success) {
+ if (out_written) |w| w.* = i;
+ return result;
+ }
+ }
+ if (out_written) |w| w.* = count;
+ return .success;
+}
+
fn getTyped(
cell_: CCell,
comptime data: CellData,
@@ -176,3 +197,42 @@ test "get wide" {
try testing.expectEqual(Result.success, get(cell, .wide, @ptrCast(&w)));
try testing.expectEqual(Wide.wide, w);
}
+
+test "get_multi success" {
+ const cell: CCell = @bitCast(Cell.init('B'));
+ var cp: u32 = 0;
+ var has_text: bool = false;
+ var written: usize = 0;
+
+ const keys = [_]CellData{ .codepoint, .has_text };
+ var values = [_]?*anyopaque{ @ptrCast(&cp), @ptrCast(&has_text) };
+ try testing.expectEqual(Result.success, get_multi(cell, keys.len, &keys, &values, &written));
+ try testing.expectEqual(keys.len, written);
+ try testing.expectEqual(@as(u32, 'B'), cp);
+ try testing.expect(has_text);
+}
+
+test "get_multi error sets out_written" {
+ const cell: CCell = @bitCast(Cell.init('C'));
+ var cp: u32 = 0;
+ var written: usize = 99;
+
+ const keys = [_]CellData{ .codepoint, .invalid };
+ var values = [_]?*anyopaque{ @ptrCast(&cp), @ptrCast(&cp) };
+ try testing.expectEqual(Result.invalid_value, get_multi(cell, keys.len, &keys, &values, &written));
+ try testing.expectEqual(1, written);
+ try testing.expectEqual(@as(u32, 'C'), cp);
+}
+
+test "get_multi null keys returns invalid_value" {
+ const cell: CCell = @bitCast(Cell.init('A'));
+ var cp: u32 = 0;
+ var values = [_]?*anyopaque{@ptrCast(&cp)};
+ try testing.expectEqual(Result.invalid_value, get_multi(cell, 1, null, &values, null));
+}
+
+test "get_multi null values returns invalid_value" {
+ const cell: CCell = @bitCast(Cell.init('A'));
+ const keys = [_]CellData{.codepoint};
+ try testing.expectEqual(Result.invalid_value, get_multi(cell, 1, &keys, null, null));
+}