diff --git a/src/termio.zig b/src/termio.zig index b2c2c1a63..d151e46dd 100644 --- a/src/termio.zig +++ b/src/termio.zig @@ -7,6 +7,7 @@ pub const reader = @import("termio/reader.zig"); pub const Options = @import("termio/Options.zig"); pub const Termio = @import("termio/Termio.zig"); pub const Thread = @import("termio/Thread.zig"); +pub const DerivedConfig = Termio.DerivedConfig; pub const Mailbox = Thread.Mailbox; test { diff --git a/src/termio/Termio.zig b/src/termio/Termio.zig index f1c500f0a..432ce158b 100644 --- a/src/termio/Termio.zig +++ b/src/termio/Termio.zig @@ -378,13 +378,7 @@ pub fn changeConfig(self: *Termio, td: *ThreadData, config: *DerivedConfig) !voi // renderer mutex so this is safe to do despite being executed // from another thread. td.ev.terminal_stream.handler.changeConfig(&self.config); - switch (td.reader) { - .manual => {}, - .exec => |*exec| { - exec.abnormal_runtime_threshold_ms = config.abnormal_runtime_threshold_ms; - exec.wait_after_command = config.wait_after_command; - }, - } + td.reader.changeConfig(&self.config); // Update the configuration that we know about. // diff --git a/src/termio/reader.zig b/src/termio/reader.zig index b83083030..99f78b561 100644 --- a/src/termio/reader.zig +++ b/src/termio/reader.zig @@ -1,5 +1,6 @@ const std = @import("std"); const configpkg = @import("../config.zig"); +const termio = @import("../termio.zig"); const Command = @import("../Command.zig"); /// The kinds of readers. @@ -45,4 +46,14 @@ pub const ThreadData = union(Kind) { /// to close the surface. wait_after_command: bool, }, + + 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; + }, + } + } };