build: update to latest libvaxis and zg api

This commit is contained in:
CJ van den Berg 2025-06-04 21:32:40 +02:00
parent 831607ffd6
commit 717bef9c61
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
6 changed files with 21 additions and 21 deletions

View file

@ -353,7 +353,7 @@ pub fn build_exe(
.imports = &.{
.{ .name = "cbor", .module = cbor_mod },
.{ .name = "thespian", .module = thespian_mod },
.{ .name = "CaseData", .module = zg_dep.module("CaseData") },
.{ .name = "LetterCasing", .module = zg_dep.module("LetterCasing") },
},
});

View file

@ -27,8 +27,8 @@
.hash = "fuzzig-0.1.1-AAAAALNIAQBmbHr-MPalGuR393Vem2pTQXI7_LXeNJgX",
},
.vaxis = .{
.url = "https://github.com/neurocyte/libvaxis/archive/9787035bd1a895355380bcca217e86293f8d6c07.tar.gz",
.hash = "vaxis-0.1.0-BWNV_I4QCQD6KmxhhplZGLIBVqxkVJPRdI3PbcfRh7_W",
.url = "https://github.com/neurocyte/libvaxis/archive/6137cb4c44a7350996f0946a069739e5075d1f23.tar.gz",
.hash = "vaxis-0.1.0-BWNV_HwOCQCw5wTV63hQGSc1QJzsNcytH6sGf1GBc0hP",
},
.zeit = .{
.url = "https://github.com/rockorager/zeit/archive/8fd203f85f597f16e0a525c1f1ca1e0bffded809.tar.gz",

View file

@ -72,12 +72,12 @@ pub fn utf8_sanitize(allocator: std.mem.Allocator, input: []const u8) error{
return output.toOwnedSlice(allocator);
}
pub const CaseData = @import("CaseData");
var case_data: ?CaseData = null;
var case_data_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
pub const LetterCasing = @import("LetterCasing");
var letter_casing: ?LetterCasing = null;
var letter_casing_arena = std.heap.ArenaAllocator.init(std.heap.c_allocator);
pub fn get_case_data() *CaseData {
if (case_data) |*cd| return cd;
case_data = CaseData.init(case_data_arena.allocator()) catch @panic("CaseData.init");
return &case_data.?;
pub fn get_letter_casing() *LetterCasing {
if (letter_casing) |*cd| return cd;
letter_casing = LetterCasing.init(letter_casing_arena.allocator()) catch @panic("LetterCasing.init");
return &letter_casing.?;
}

View file

@ -48,8 +48,8 @@ pub fn main() anyerror!void {
}
const a = std.heap.c_allocator;
const case_data = @import("Buffer").unicode.get_case_data();
_ = case_data; // no need to free case_data as it is globally static
const letter_casing = @import("Buffer").unicode.get_letter_casing();
_ = letter_casing; // no need to free letter_casing as it is globally static
const Flags = struct {
pub const description =

View file

@ -579,7 +579,7 @@ const Loop = struct {
switch (builtin.os.tag) {
.windows => {
var parser: vaxis.Parser = .{
.grapheme_data = &self.vaxis.unicode.width_data.g_data,
.graphemes = &self.vaxis.unicode.graphemes,
};
const a = self.vaxis.opts.system_clipboard_allocator orelse @panic("no tty allocator");
while (!self.should_quit) {
@ -588,7 +588,7 @@ const Loop = struct {
},
else => {
var parser: vaxis.Parser = .{
.grapheme_data = &self.vaxis.unicode.width_data.g_data,
.graphemes = &self.vaxis.unicode.graphemes,
};
const a = self.vaxis.opts.system_clipboard_allocator orelse @panic("no tty allocator");

View file

@ -5672,7 +5672,7 @@ pub const Editor = struct {
var sfa = std.heap.stackFallback(4096, self.allocator);
const cut_text = copy_selection(root, sel.*, sfa.get(), self.metrics) catch return error.Stop;
defer allocator.free(cut_text);
const ucased = Buffer.unicode.get_case_data().toUpperStr(allocator, cut_text) catch return error.Stop;
const ucased = Buffer.unicode.get_letter_casing().toUpperStr(allocator, cut_text) catch return error.Stop;
defer allocator.free(ucased);
root = try self.delete_selection(root, cursel, allocator);
root = self.insert(root, cursel, ucased, allocator) catch return error.Stop;
@ -5700,7 +5700,7 @@ pub const Editor = struct {
var sfa = std.heap.stackFallback(4096, self.allocator);
const cut_text = copy_selection(root, sel.*, sfa.get(), self.metrics) catch return error.Stop;
defer allocator.free(cut_text);
const ucased = Buffer.unicode.get_case_data().toLowerStr(allocator, cut_text) catch return error.Stop;
const ucased = Buffer.unicode.get_letter_casing().toLowerStr(allocator, cut_text) catch return error.Stop;
defer allocator.free(ucased);
root = try self.delete_selection(root, cursel, allocator);
root = self.insert(root, cursel, ucased, allocator) catch return error.Stop;
@ -5732,13 +5732,13 @@ pub const Editor = struct {
result: *std.ArrayListUnmanaged(u8),
allocator: std.mem.Allocator,
const Error = @typeInfo(@typeInfo(@TypeOf(Buffer.unicode.CaseData.toUpperStr)).@"fn".return_type.?).error_union.error_set;
const Error = @typeInfo(@typeInfo(@TypeOf(Buffer.unicode.LetterCasing.toUpperStr)).@"fn".return_type.?).error_union.error_set;
pub fn write(writer: *@This(), bytes: []const u8) Error!void {
const cd = Buffer.unicode.get_case_data();
const flipped = if (cd.isLowerStr(bytes))
try cd.toUpperStr(writer.self_.allocator, bytes)
const letter_casing = Buffer.unicode.get_letter_casing();
const flipped = if (letter_casing.isLowerStr(bytes))
try letter_casing.toUpperStr(writer.self_.allocator, bytes)
else
try cd.toLowerStr(writer.self_.allocator, bytes);
try letter_casing.toLowerStr(writer.self_.allocator, bytes);
defer writer.self_.allocator.free(flipped);
return writer.result.appendSlice(writer.allocator, flipped);
}