refactor: zigify imports and usages
This commit is contained in:
@@ -7,7 +7,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
pub fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
pub fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const y = 2;
|
const y = 2;
|
||||||
const x = size.x / 2 -| (text.len / 2);
|
const x = size.x / 2 -| (text.len / 2);
|
||||||
@@ -191,6 +191,7 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const input = zterm.input;
|
const input = zterm.input;
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -57,7 +57,7 @@ const Clickable = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
const this: *@This() = @ptrCast(@alignCast(ctx));
|
const this: *@This() = @ptrCast(@alignCast(ctx));
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = size.y / 2 -| (text.len / 2);
|
const row = size.y / 2 -| (text.len / 2);
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -140,6 +140,7 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {
|
const App = zterm.App(union(enum) {
|
||||||
click: [:0]const u8,
|
click: [:0]const u8,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -67,7 +67,7 @@ const InputField = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
const this: *@This() = @ptrCast(@alignCast(ctx));
|
const this: *@This() = @ptrCast(@alignCast(ctx));
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
if (this.input.items.len == 0) return;
|
if (this.input.items.len == 0) return;
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ const MouseDraw = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
const this: *@This() = @ptrCast(@alignCast(ctx));
|
const this: *@This() = @ptrCast(@alignCast(ctx));
|
||||||
|
|
||||||
if (this.position) |pos| {
|
if (this.position) |pos| {
|
||||||
@@ -220,6 +220,7 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {
|
const App = zterm.App(union(enum) {
|
||||||
accept: []u21,
|
accept: []u21,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -36,7 +36,7 @@ const HelloWorldText = packed struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = size.y / 2;
|
const row = size.y / 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -192,6 +192,7 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const input = zterm.input;
|
const input = zterm.input;
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -33,7 +33,7 @@ const InfoText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -68,7 +68,7 @@ const ErrorNotification = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
const this: *@This() = @ptrCast(@alignCast(ctx));
|
const this: *@This() = @ptrCast(@alignCast(ctx));
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
if (this.msg) |msg| {
|
if (this.msg) |msg| {
|
||||||
const row = size.y -| 2;
|
const row = size.y -| 2;
|
||||||
@@ -153,5 +153,6 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -109,5 +109,6 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -101,5 +101,6 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -117,5 +117,6 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -100,5 +100,6 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -96,5 +96,6 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const QuitText = struct {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
const row = 2;
|
const row = 2;
|
||||||
const col = size.x / 2 -| (text.len / 2);
|
const col = size.x / 2 -| (text.len / 2);
|
||||||
@@ -34,7 +34,7 @@ const TextStyles = struct {
|
|||||||
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
fn content(ctx: *anyopaque, cells: []zterm.Cell, size: zterm.Point) !void {
|
||||||
@setEvalBranchQuota(50000);
|
@setEvalBranchQuota(50000);
|
||||||
_ = ctx;
|
_ = ctx;
|
||||||
std.debug.assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
assert(cells.len == @as(usize, size.x) * @as(usize, size.y));
|
||||||
|
|
||||||
var row: usize = 0;
|
var row: usize = 0;
|
||||||
var col: usize = 0;
|
var col: usize = 0;
|
||||||
@@ -151,5 +151,6 @@ pub fn main() !void {
|
|||||||
const log = std.log.scoped(.default);
|
const log = std.log.scoped(.default);
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
const zterm = @import("zterm");
|
const zterm = @import("zterm");
|
||||||
const App = zterm.App(union(enum) {});
|
const App = zterm.App(union(enum) {});
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ pub fn Scrollable(Event: type) type {
|
|||||||
|
|
||||||
fn content(ctx: *anyopaque, cells: []Cell, size: Point) !void {
|
fn content(ctx: *anyopaque, cells: []Cell, size: Point) !void {
|
||||||
const this: *@This() = @ptrCast(@alignCast(ctx));
|
const this: *@This() = @ptrCast(@alignCast(ctx));
|
||||||
std.debug.assert(cells.len == @as(usize, this.size.x) * @as(usize, this.size.y));
|
assert(cells.len == @as(usize, this.size.x) * @as(usize, this.size.y));
|
||||||
const offset_x: usize = if (this.configuration.x_axis) 1 else 0;
|
const offset_x: usize = if (this.configuration.x_axis) 1 else 0;
|
||||||
const offset_y: usize = if (this.configuration.y_axis) 1 else 0;
|
const offset_y: usize = if (this.configuration.y_axis) 1 else 0;
|
||||||
|
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ pub fn expectEqualCells(origin: Point, size: Point, expected: []const Cell, actu
|
|||||||
// test failed
|
// test failed
|
||||||
try buffer.flush();
|
try buffer.flush();
|
||||||
|
|
||||||
std.debug.lockStdErr();
|
debug.lockStdErr();
|
||||||
defer std.debug.unlockStdErr();
|
defer debug.unlockStdErr();
|
||||||
|
|
||||||
const std_writer = std.io.getStdErr().writer();
|
const std_writer = std.io.getStdErr().writer();
|
||||||
try std_writer.writeAll(output.items);
|
try std_writer.writeAll(output.items);
|
||||||
@@ -190,6 +190,7 @@ pub fn expectEqualCells(origin: Point, size: Point, expected: []const Cell, actu
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const debug = std.debug;
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
const event = @import("event.zig");
|
const event = @import("event.zig");
|
||||||
|
|||||||
Reference in New Issue
Block a user