an experimental irc client

update vaxis

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>

+22 -13
+2 -2
build.zig.zon
··· 7 7 .hash = "12208603e0f51fa6ce7201d8e851c5979b6b78887434623ac87a0f2a5a3dd3e75130", 8 8 }, 9 9 .vaxis = .{ 10 - .url = "git+https://github.com/rockorager/libvaxis#55809160b9623de6b2de6eba1fa56cddec4427b3", 11 - .hash = "12209ecb24ac6602e46ad92767dcda3777c2a6cf74d3e51e5e95b599d0ce70d94c62", 10 + .url = "git+https://github.com/rockorager/libvaxis#49cc8ae7c42956cc9b93832d0eef7ae27a46a413", 11 + .hash = "12202fb0c7cd677037c5618738b9dab72238f92ecac2b477292eacd31e4ca622fa96", 12 12 }, 13 13 .zeit = .{ 14 14 .url = "git+https://github.com/rockorager/zeit#d5ce6b6b6336b4dc9c0d1d67339dea81fb4d2e77",
+1
sed
··· 1 + error: unrecognized parameter: '-n'
+19 -11
src/App.zig
··· 70 70 71 71 /// the vaxis instance for our application 72 72 vx: vaxis.Vaxis, 73 + tty: vaxis.Tty, 73 74 74 75 loop: ?vaxis.Loop(Event) = null, 75 76 ··· 125 126 .clients = std.ArrayList(*Client).init(alloc), 126 127 .lua = try Lua.init(&alloc), 127 128 .vx = vx, 129 + .tty = try vaxis.Tty.init(), 128 130 .content_segments = std.ArrayList(vaxis.Segment).init(alloc), 129 131 .binds = try std.ArrayList(Bind).initCapacity(alloc, 16), 130 132 .paste_buffer = std.ArrayList(u8).init(alloc), ··· 177 179 178 180 // close vaxis 179 181 { 180 - self.vx.deinit(self.alloc); 182 + self.vx.deinit(self.alloc, self.tty.anyWriter()); 181 183 } 182 184 183 185 self.lua.deinit(); ··· 218 220 219 221 pub fn run(self: *App) !void { 220 222 // start vaxis 223 + const writer = self.tty.anyWriter(); 221 224 { 222 - self.loop = .{ .vaxis = &self.vx }; 223 - try self.loop.?.run(); 224 - try self.vx.enterAltScreen(); 225 - try self.vx.queryTerminal(); 226 - try self.vx.setMouseMode(true); 227 - try self.vx.setBracketedPaste(true); 225 + self.loop = .{ 226 + .vaxis = &self.vx, 227 + .tty = &self.tty, 228 + }; 229 + try self.loop.?.start(); 230 + try self.vx.enterAltScreen(writer); 231 + try self.vx.queryTerminal(writer, 1 * std.time.ns_per_s); 232 + try self.vx.setMouseMode(writer, true); 233 + try self.vx.setBracketedPaste(writer, true); 228 234 } 229 235 230 236 // start our write thread ··· 368 374 self.state.mouse = mouse; 369 375 log.debug("mouse event: {}", .{mouse}); 370 376 }, 371 - .winsize => |ws| try self.vx.resize(self.alloc, ws), 377 + .winsize => |ws| try self.vx.resize(self.alloc, writer, ws), 372 378 .connect => |cfg| { 373 379 const client = try self.alloc.create(Client); 374 380 client.* = try Client.init(self.alloc, self, cfg); ··· 751 757 try channel.messages.append(msg); 752 758 const content = iter.next() orelse continue; 753 759 if (std.mem.indexOf(u8, content, msg.client.config.nick)) |_| { 754 - try self.vx.notify("zircon", content); 760 + try self.vx.notify(writer, "zircon", content); 755 761 } 756 762 const time = msg.time orelse continue; 757 763 if (time.instant().unixTimestamp() > channel.last_read) ··· 1714 1720 for (self.content_segments.items) |item| { 1715 1721 try list.appendSlice(item.text); 1716 1722 } 1717 - try self.vx.copyToSystemClipboard(list.items, self.alloc); 1723 + try self.vx.copyToSystemClipboard(self.tty.anyWriter(), list.items, self.alloc); 1718 1724 bg_idx = 3; 1719 1725 } 1720 1726 content_win.fill(.{ ··· 1958 1964 1959 1965 self.state.buffers.count = row; 1960 1966 1961 - try self.vx.render(); 1967 + var buffered = self.tty.bufferedWriter(); 1968 + try self.vx.render(buffered.writer().any()); 1969 + try buffered.flush(); 1962 1970 }