diff options
| author | Mitchell Hashimoto <mitchell.hashimoto@gmail.com> | 2023-10-12 20:46:26 -0700 |
|---|---|---|
| committer | Mitchell Hashimoto <mitchell.hashimoto@gmail.com> | 2023-10-12 20:46:26 -0700 |
| commit | 5ce50d08a1bd1d2adf338109d78ef8f13b4ee27c (patch) | |
| tree | 309e16e7ebe067d7e542aa6fa8841dd87302e9f6 /src/termio/Thread.zig | |
| parent | 8c61f8d890866e55ffa145b4c2844d6319b18acf (diff) | |
terminal: linefeed mode
Diffstat (limited to 'src/termio/Thread.zig')
| -rw-r--r-- | src/termio/Thread.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/termio/Thread.zig b/src/termio/Thread.zig index 0b345ac1f..459cec97c 100644 --- a/src/termio/Thread.zig +++ b/src/termio/Thread.zig @@ -62,6 +62,10 @@ 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, @@ -175,11 +179,12 @@ fn drainMailbox(self: *Thread) !void { .scroll_viewport => |v| try self.impl.scrollViewport(v), .jump_to_prompt => |v| try self.impl.jumpToPrompt(v), .start_synchronized_output => self.startSynchronizedOutput(), - .write_small => |v| try self.impl.queueWrite(v.data[0..v.len]), - .write_stable => |v| try self.impl.queueWrite(v), + .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), .write_alloc => |v| { defer v.alloc.free(v.data); - try self.impl.queueWrite(v.data); + try self.impl.queueWrite(v.data, self.linefeed_mode); }, } } |
