diff --git a/src/termio/Termio.zig b/src/termio/Termio.zig index 457a66361..ef4f78b1f 100644 --- a/src/termio/Termio.zig +++ b/src/termio/Termio.zig @@ -256,9 +256,7 @@ pub fn threadEnter(self: *Termio, thread: *termio.Thread, data: *ThreadData) !vo .renderer_state = self.renderer_state, .surface_mailbox = self.surface_mailbox, .mailbox = &self.mailbox, - - // Placeholder until setup below - .backend = .{ .manual = {} }, + .backend = undefined, // Backend must replace this on threadEnter }; // Setup our backend diff --git a/src/termio/backend.zig b/src/termio/backend.zig index 75342cbc7..b29df89c6 100644 --- a/src/termio/backend.zig +++ b/src/termio/backend.zig @@ -19,17 +19,11 @@ const Pty = @import("../pty.zig").Pty; // enough to satisfy most write requests. It must be a power of 2. const WRITE_REQ_PREALLOC = std.math.pow(usize, 2, 5); -/// The kinds of readers. -pub const Kind = enum { manual, exec }; +/// The kinds of backends. +pub const Kind = enum { exec }; -/// Configuration for the various reader types. +/// Configuration for the various backend types. pub const Config = union(Kind) { - /// Manual means that the termio caller will handle reading input - /// and passing it to the termio implementation. Note that even if you - /// select a different reader, you can always still manually provide input; - /// this config just makes it so that it is ONLY manual input. - manual: void, - /// Exec uses posix exec to run a command with a pty. exec: termio.Exec.Config, }; @@ -37,19 +31,16 @@ pub const Config = union(Kind) { /// Backend implementations. A backend is responsible for owning the pty /// behavior and providing read/write capabilities. pub const Backend = union(Kind) { - manual: void, exec: termio.Exec, pub fn deinit(self: *Backend) void { switch (self.*) { - .manual => {}, .exec => |*exec| exec.deinit(), } } pub fn initTerminal(self: *Backend, t: *terminal.Terminal) void { switch (self.*) { - .manual => {}, .exec => |*exec| exec.initTerminal(t), } } @@ -61,14 +52,12 @@ pub const Backend = union(Kind) { td: *termio.Termio.ThreadData, ) !void { switch (self.*) { - .manual => {}, .exec => |*exec| try exec.threadEnter(alloc, io, td), } } pub fn threadExit(self: *Backend, td: *termio.Termio.ThreadData) void { switch (self.*) { - .manual => {}, .exec => |*exec| exec.threadExit(td), } } @@ -79,7 +68,6 @@ pub const Backend = union(Kind) { screen_size: renderer.ScreenSize, ) !void { switch (self.*) { - .manual => {}, .exec => |*exec| try exec.resize(grid_size, screen_size), } } @@ -92,7 +80,6 @@ pub const Backend = union(Kind) { linefeed: bool, ) !void { switch (self.*) { - .manual => {}, .exec => |*exec| try exec.queueWrite(alloc, td, data, linefeed), } } @@ -105,7 +92,6 @@ pub const Backend = union(Kind) { runtime_ms: u64, ) !void { switch (self.*) { - .manual => {}, .exec => |*exec| try exec.childExitedAbnormally( gpa, t, @@ -118,19 +104,16 @@ pub const Backend = union(Kind) { /// Termio thread data. See termio.ThreadData for docs. pub const ThreadData = union(Kind) { - manual: void, exec: termio.Exec.ThreadData, pub fn deinit(self: *ThreadData, alloc: Allocator) void { switch (self.*) { - .manual => {}, .exec => |*exec| exec.deinit(alloc), } } pub fn changeConfig(self: *ThreadData, config: *termio.DerivedConfig) void { switch (self.*) { - .manual => {}, .exec => |*exec| { exec.abnormal_runtime_threshold_ms = config.abnormal_runtime_threshold_ms; exec.wait_after_command = config.wait_after_command;