diff options
| author | Mitchell Hashimoto <mitchell.hashimoto@gmail.com> | 2023-10-22 08:46:30 -0700 |
|---|---|---|
| committer | Mitchell Hashimoto <mitchell.hashimoto@gmail.com> | 2023-10-24 15:27:15 -0700 |
| commit | 5a299e14e48cd3987453c56a0c661dbc783c48b7 (patch) | |
| tree | f228d4f21285f80cfd95670bd202e1798bd75345 /src/termio/Thread.zig | |
| parent | afa08ffc02857ac62c414c98b0453c721ac1f24f (diff) | |
all threads are notified of inspector state, trigger render
Diffstat (limited to 'src/termio/Thread.zig')
| -rw-r--r-- | src/termio/Thread.zig | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/termio/Thread.zig b/src/termio/Thread.zig index 459cec97c..93faa38d5 100644 --- a/src/termio/Thread.zig +++ b/src/termio/Thread.zig @@ -62,14 +62,19 @@ sync_reset_cancel_c: xev.Completion = .{}, /// The underlying IO implementation. impl: *termio.Impl, -/// True if linefeed mode is enabled. This is duplicated here so that the -/// write thread doesn't need to grab a lock to check this on every write. -linefeed_mode: bool = false, - /// The mailbox that can be used to send this thread messages. Note /// this is a blocking queue so if it is full you will get errors (or block). mailbox: *Mailbox, +flags: packed struct { + /// True if linefeed mode is enabled. This is duplicated here so that the + /// write thread doesn't need to grab a lock to check this on every write. + linefeed_mode: bool = false, + + /// This is true when the inspector is active. + has_inspector: bool = false, +} = .{}, + /// Initialize the thread. This does not START the thread. This only sets /// up all the internal state necessary prior to starting the thread. It /// is up to the caller to start the thread with the threadMain entrypoint. @@ -174,17 +179,18 @@ fn drainMailbox(self: *Thread) !void { defer config.alloc.destroy(config.ptr); try self.impl.changeConfig(config.ptr); }, + .inspector => |v| self.flags.has_inspector = v, .resize => |v| self.handleResize(v), .clear_screen => |v| try self.impl.clearScreen(v.history), .scroll_viewport => |v| try self.impl.scrollViewport(v), .jump_to_prompt => |v| try self.impl.jumpToPrompt(v), .start_synchronized_output => self.startSynchronizedOutput(), - .linefeed_mode => |v| self.linefeed_mode = v, - .write_small => |v| try self.impl.queueWrite(v.data[0..v.len], self.linefeed_mode), - .write_stable => |v| try self.impl.queueWrite(v, self.linefeed_mode), + .linefeed_mode => |v| self.flags.linefeed_mode = v, + .write_small => |v| try self.impl.queueWrite(v.data[0..v.len], self.flags.linefeed_mode), + .write_stable => |v| try self.impl.queueWrite(v, self.flags.linefeed_mode), .write_alloc => |v| { defer v.alloc.free(v.data); - try self.impl.queueWrite(v.data, self.linefeed_mode); + try self.impl.queueWrite(v.data, self.flags.linefeed_mode); }, } } |
