mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
pkg/macos: character set in range
This commit is contained in:
@ -14,6 +14,15 @@ pub const CharacterSet = opaque {
|
||||
))) orelse Allocator.Error.OutOfMemory;
|
||||
}
|
||||
|
||||
pub fn createWithCharactersInRange(
|
||||
range: foundation.Range,
|
||||
) Allocator.Error!*CharacterSet {
|
||||
return @intToPtr(?*CharacterSet, @ptrToInt(c.CFCharacterSetCreateWithCharactersInRange(
|
||||
null,
|
||||
range.cval(),
|
||||
))) orelse Allocator.Error.OutOfMemory;
|
||||
}
|
||||
|
||||
pub fn release(self: *CharacterSet) void {
|
||||
c.CFRelease(self);
|
||||
}
|
||||
@ -28,3 +37,13 @@ test "character set" {
|
||||
const cs = try CharacterSet.createWithCharactersInString(str);
|
||||
defer cs.release();
|
||||
}
|
||||
|
||||
test "character set range" {
|
||||
//const testing = std.testing;
|
||||
|
||||
const cs = try CharacterSet.createWithCharactersInRange(.{
|
||||
.location = 'A',
|
||||
.length = 1,
|
||||
});
|
||||
defer cs.release();
|
||||
}
|
||||
|
Reference in New Issue
Block a user