chor: bumb zig version to 0.16.0-dev
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m41s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m41s
This commit is contained in:
@@ -57,18 +57,20 @@ const Spinner = struct {
|
||||
};
|
||||
|
||||
const InputField = struct {
|
||||
allocator: std.mem.Allocator,
|
||||
input: std.ArrayList(u21),
|
||||
queue: *App.Queue,
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator, queue: *App.Queue) @This() {
|
||||
return .{
|
||||
.input = .init(allocator),
|
||||
.allocator = allocator,
|
||||
.input = std.ArrayList(u21).initCapacity(allocator, 8) catch unreachable,
|
||||
.queue = queue,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(this: @This()) void {
|
||||
this.input.deinit();
|
||||
pub fn deinit(this: *@This()) void {
|
||||
this.input.deinit(this.allocator);
|
||||
}
|
||||
|
||||
pub fn element(this: *@This()) App.Element {
|
||||
@@ -85,10 +87,10 @@ const InputField = struct {
|
||||
const this: *@This() = @ptrCast(@alignCast(ctx));
|
||||
switch (event) {
|
||||
.key => |key| {
|
||||
if (key.isAscii()) try this.input.append(key.cp);
|
||||
if (key.isAscii()) try this.input.append(this.allocator, key.cp);
|
||||
|
||||
if (key.eql(.{ .cp = zterm.input.Enter }) or key.eql(.{ .cp = zterm.input.KpEnter }))
|
||||
this.queue.push(.{ .accept = try this.input.toOwnedSlice() });
|
||||
this.queue.push(.{ .accept = try this.input.toOwnedSlice(this.allocator) });
|
||||
|
||||
if (key.eql(.{ .cp = zterm.input.Backspace }))
|
||||
_ = this.input.pop();
|
||||
|
||||
Reference in New Issue
Block a user