From 638e05454f12d695a7c1e62cb2de27646f7b0c4c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 19 Mar 2023 10:25:58 -0700 Subject: [PATCH] termio: allow write req pool to grow if needed This may be necessary if large amounts of data is being written (i.e. a large clipboard paste). The pool is never shrunk again for now but once the writes go through the buffer items will of course be reused so its unlikely to need to continue growing. --- src/termio/Exec.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index c1a903b7f..a662d8534 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -233,8 +233,8 @@ pub inline fn queueWrite(self: *Exec, data: []const u8) !void { // our cached buffers that we can queue to the stream. var i: usize = 0; while (i < data.len) { - const req = try ev.write_req_pool.get(); - const buf = try ev.write_buf_pool.get(); + const req = try ev.write_req_pool.getGrow(self.alloc); + const buf = try ev.write_buf_pool.getGrow(self.alloc); const end = @min(data.len, i + buf.len); fastmem.copy(u8, buf, data[i..end]); ev.data_stream.queueWrite(