build: update to libvaxis with uucode support
This commit is contained in:
parent
765a5d2dc7
commit
b2b34e4710
9 changed files with 21 additions and 35 deletions
|
|
@ -324,7 +324,7 @@ pub fn build_exe(
|
||||||
.root_source_file = b.path("src/tracy_noop.zig"),
|
.root_source_file = b.path("src/tracy_noop.zig"),
|
||||||
});
|
});
|
||||||
|
|
||||||
const zg_dep = vaxis_dep.builder.dependency("zg", .{
|
const zg_dep = b.dependency("zg", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@
|
||||||
.hash = "fuzzig-0.1.1-Ji0xivxIAQBD0g8O_NV_0foqoPf3elsg9Sc3pNfdVH4D",
|
.hash = "fuzzig-0.1.1-Ji0xivxIAQBD0g8O_NV_0foqoPf3elsg9Sc3pNfdVH4D",
|
||||||
},
|
},
|
||||||
.vaxis = .{
|
.vaxis = .{
|
||||||
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#57a4662955bc70ee13248e8c209ff7db13aeeb55",
|
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#e9c1111efd98aeb7c2db45d3e31987429fb5f26d",
|
||||||
.hash = "vaxis-0.5.1-BWNV_IQjCQDoLX03Eb2iQTBYqReabnFPAq5cZROLqNdJ",
|
.hash = "vaxis-0.5.1-BWNV_BkyCQAo2UBeY_gbzP09d4pHDaqtg44snF5k3mh2",
|
||||||
},
|
},
|
||||||
.zeit = .{
|
.zeit = .{
|
||||||
.url = "git+https://github.com/rockorager/zeit?ref=zig-0.15#ed2ca60db118414bda2b12df2039e33bad3b0b88",
|
.url = "git+https://github.com/rockorager/zeit?ref=zig-0.15#ed2ca60db118414bda2b12df2039e33bad3b0b88",
|
||||||
|
|
@ -42,6 +42,10 @@
|
||||||
.hash = "zigwin32-25.0.28-preview-AAAAAICM5AMResOGQnQ85mfe60TTOQeMtt7GRATUOKoP",
|
.hash = "zigwin32-25.0.28-preview-AAAAAICM5AMResOGQnQ85mfe60TTOQeMtt7GRATUOKoP",
|
||||||
.lazy = true,
|
.lazy = true,
|
||||||
},
|
},
|
||||||
|
.zg = .{
|
||||||
|
.url = "git+https://codeberg.org/neurocyte/zg?ref=master#cdcab8b9ea3458efd710008055d993c5dbdb1af7",
|
||||||
|
.hash = "zg-0.15.2-oGqU3AtAtAI7gs7zPvzg2_TlVIqi9wCNEw7DLvD5OvDN",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
.paths = .{
|
.paths = .{
|
||||||
"include",
|
"include",
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,6 @@ pub fn main() anyerror!void {
|
||||||
}
|
}
|
||||||
|
|
||||||
const a = std.heap.c_allocator;
|
const a = std.heap.c_allocator;
|
||||||
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 {
|
const Flags = struct {
|
||||||
pub const description =
|
pub const description =
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,13 @@ plane_: Plane,
|
||||||
const View = struct {
|
const View = struct {
|
||||||
allocator: std.mem.Allocator,
|
allocator: std.mem.Allocator,
|
||||||
screen: vaxis.Screen,
|
screen: vaxis.Screen,
|
||||||
unicode: *const vaxis.Unicode,
|
|
||||||
|
|
||||||
pub const Config = struct {
|
pub const Config = struct {
|
||||||
h: u16,
|
h: u16,
|
||||||
w: u16,
|
w: u16,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn init(allocator: std.mem.Allocator, unicode: *const vaxis.Unicode, config: Config) std.mem.Allocator.Error!View {
|
pub fn init(allocator: std.mem.Allocator, config: Config) std.mem.Allocator.Error!View {
|
||||||
return .{
|
return .{
|
||||||
.allocator = allocator,
|
.allocator = allocator,
|
||||||
.screen = try vaxis.Screen.init(allocator, .{
|
.screen = try vaxis.Screen.init(allocator, .{
|
||||||
|
|
@ -29,7 +28,6 @@ const View = struct {
|
||||||
.x_pixel = 0,
|
.x_pixel = 0,
|
||||||
.y_pixel = 0,
|
.y_pixel = 0,
|
||||||
}),
|
}),
|
||||||
.unicode = unicode,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -45,10 +43,10 @@ pub const Options = struct {
|
||||||
w: u16 = 0,
|
w: u16 = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn init(allocator: std.mem.Allocator, unicode: *const vaxis.Unicode, opts: Options) std.mem.Allocator.Error!*Layer {
|
pub fn init(allocator: std.mem.Allocator, opts: Options) std.mem.Allocator.Error!*Layer {
|
||||||
const self = try allocator.create(Layer);
|
const self = try allocator.create(Layer);
|
||||||
self.* = .{
|
self.* = .{
|
||||||
.view = try View.init(allocator, unicode, .{
|
.view = try View.init(allocator, .{
|
||||||
.h = opts.h,
|
.h = opts.h,
|
||||||
.w = opts.w,
|
.w = opts.w,
|
||||||
}),
|
}),
|
||||||
|
|
@ -81,7 +79,6 @@ fn window(self: *Layer) vaxis.Window {
|
||||||
.width = self.view.screen.width,
|
.width = self.view.screen.width,
|
||||||
.height = self.view.screen.height,
|
.height = self.view.screen.height,
|
||||||
.screen = &self.view.screen,
|
.screen = &self.view.screen,
|
||||||
.unicode = self.view.unicode,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ pub fn putstr(self: *Plane, text: []const u8) !usize {
|
||||||
var result: usize = 0;
|
var result: usize = 0;
|
||||||
const height = self.window.height;
|
const height = self.window.height;
|
||||||
const width = self.window.width;
|
const width = self.window.width;
|
||||||
var iter = self.window.unicode.graphemeIterator(text);
|
var iter = vaxis.unicode.graphemeIterator(text);
|
||||||
while (iter.next()) |grapheme| {
|
while (iter.next()) |grapheme| {
|
||||||
const s = grapheme.bytes(text);
|
const s = grapheme.bytes(text);
|
||||||
if (std.mem.eql(u8, s, "\n")) {
|
if (std.mem.eql(u8, s, "\n")) {
|
||||||
|
|
@ -207,7 +207,7 @@ pub fn putstr(self: *Plane, text: []const u8) !usize {
|
||||||
|
|
||||||
pub fn putstr_unicode(self: *Plane, text: []const u8) !usize {
|
pub fn putstr_unicode(self: *Plane, text: []const u8) !usize {
|
||||||
var result: usize = 0;
|
var result: usize = 0;
|
||||||
var iter = self.window.unicode.graphemeIterator(text);
|
var iter = vaxis.unicode.graphemeIterator(text);
|
||||||
while (iter.next()) |grapheme| {
|
while (iter.next()) |grapheme| {
|
||||||
const s_ = grapheme.bytes(text);
|
const s_ = grapheme.bytes(text);
|
||||||
const s = switch (s_[0]) {
|
const s = switch (s_[0]) {
|
||||||
|
|
@ -443,7 +443,7 @@ pub fn egc_length(self: *const Plane, egcs: []const u8, colcount: *c_int, abs_co
|
||||||
colcount.* = @intCast(tab_width - (abs_col % tab_width));
|
colcount.* = @intCast(tab_width - (abs_col % tab_width));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
var iter = self.window.unicode.graphemeIterator(egcs);
|
var iter = vaxis.unicode.graphemeIterator(egcs);
|
||||||
const grapheme = iter.next() orelse {
|
const grapheme = iter.next() orelse {
|
||||||
colcount.* = 1;
|
colcount.* = 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -469,8 +469,8 @@ pub fn egc_chunk_width(self: *const Plane, chunk_: []const u8, abs_col_: usize,
|
||||||
return colcount;
|
return colcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn egc_last(self: *const Plane, egcs: []const u8) []const u8 {
|
pub fn egc_last(egcs: []const u8) []const u8 {
|
||||||
var iter = self.window.unicode.graphemeIterator(egcs);
|
var iter = vaxis.unicode.graphemeIterator(egcs);
|
||||||
var last: []const u8 = egcs[0..0];
|
var last: []const u8 = egcs[0..0];
|
||||||
while (iter.next()) |grapheme| last = grapheme.bytes(egcs);
|
while (iter.next()) |grapheme| last = grapheme.bytes(egcs);
|
||||||
return last;
|
return last;
|
||||||
|
|
@ -493,9 +493,8 @@ pub fn metrics(self: *const Plane, tab_width: usize) Buffer.Metrics {
|
||||||
}.f,
|
}.f,
|
||||||
.tab_width = tab_width,
|
.tab_width = tab_width,
|
||||||
.egc_last = struct {
|
.egc_last = struct {
|
||||||
fn f(self_: Buffer.Metrics, egcs: []const u8) []const u8 {
|
fn f(_: Buffer.Metrics, egcs: []const u8) []const u8 {
|
||||||
const plane: *const Plane = @ptrCast(@alignCast(self_.ctx));
|
return egc_last(egcs);
|
||||||
return plane.egc_last(egcs);
|
|
||||||
}
|
}
|
||||||
}.f,
|
}.f,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -683,18 +683,14 @@ const Loop = struct {
|
||||||
fn ttyRun(self: *Loop) !void {
|
fn ttyRun(self: *Loop) !void {
|
||||||
switch (builtin.os.tag) {
|
switch (builtin.os.tag) {
|
||||||
.windows => {
|
.windows => {
|
||||||
var parser: vaxis.Parser = .{
|
var parser: vaxis.Parser = .{};
|
||||||
.grapheme_data = &self.vaxis.unicode.width_data.graphemes,
|
|
||||||
};
|
|
||||||
const a = self.vaxis.opts.system_clipboard_allocator orelse @panic("no tty allocator");
|
const a = self.vaxis.opts.system_clipboard_allocator orelse @panic("no tty allocator");
|
||||||
while (!self.should_quit) {
|
while (!self.should_quit) {
|
||||||
self.postEvent(try self.tty.nextEvent(&parser, a));
|
self.postEvent(try self.tty.nextEvent(&parser, a));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
else => {
|
else => {
|
||||||
var parser: vaxis.Parser = .{
|
var parser: vaxis.Parser = .{};
|
||||||
.grapheme_data = &self.vaxis.unicode.width_data.graphemes,
|
|
||||||
};
|
|
||||||
|
|
||||||
const a = self.vaxis.opts.system_clipboard_allocator orelse @panic("no tty allocator");
|
const a = self.vaxis.opts.system_clipboard_allocator orelse @panic("no tty allocator");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1606,11 +1606,7 @@ fn stdplane(self: *Self) renderer.Plane {
|
||||||
pub fn top_layer(opts: renderer.Layer.Options) ?*renderer.Plane {
|
pub fn top_layer(opts: renderer.Layer.Options) ?*renderer.Plane {
|
||||||
const self = current();
|
const self = current();
|
||||||
if (self.top_layer_) |_| return null;
|
if (self.top_layer_) |_| return null;
|
||||||
self.top_layer_ = renderer.Layer.init(
|
self.top_layer_ = renderer.Layer.init(self.allocator, opts) catch @panic("OOM toplayer");
|
||||||
self.allocator,
|
|
||||||
self.rdr_.stdplane().window.unicode,
|
|
||||||
opts,
|
|
||||||
) catch @panic("OOM toplayer");
|
|
||||||
return self.top_layer_.?.plane();
|
return self.top_layer_.?.plane();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1626,7 +1622,7 @@ pub fn egc_chunk_width(chunk: []const u8, abs_col: usize, tab_width: usize) usiz
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn egc_last(egcs: []const u8) []const u8 {
|
pub fn egc_last(egcs: []const u8) []const u8 {
|
||||||
return plane().egc_last(egcs);
|
return renderer.Plane.egc_last(egcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn screen() Widget.Box {
|
pub fn screen() Widget.Box {
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,6 @@ pub fn main() anyerror!void {
|
||||||
}
|
}
|
||||||
|
|
||||||
const a = std.heap.c_allocator;
|
const a = std.heap.c_allocator;
|
||||||
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 {
|
const Flags = struct {
|
||||||
pub const description =
|
pub const description =
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,6 @@ pub fn main() anyerror!void {
|
||||||
}
|
}
|
||||||
|
|
||||||
const a = std.heap.c_allocator;
|
const a = std.heap.c_allocator;
|
||||||
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 {
|
const Flags = struct {
|
||||||
pub const description =
|
pub const description =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue