feat(terminal): add scrollback support

This commit is contained in:
CJ van den Berg 2026-02-25 20:33:14 +01:00
parent 69b0885f4b
commit 3e265dade5
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 12 additions and 2 deletions

View file

@ -30,8 +30,8 @@
.hash = "fuzzig-0.1.1-Ji0xivxIAQBD0g8O_NV_0foqoPf3elsg9Sc3pNfdVH4D",
},
.vaxis = .{
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#8fba2b2b14174f73a957b3b4b0e1c30f25a78577",
.hash = "vaxis-0.5.1-BWNV_HJQCQAVq-jmKeSh0Ur4DLbkc3DUP-amXI3k22TB",
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#8561409c5cd0e1799118d188764ac3d6edae6445",
.hash = "vaxis-0.5.1-BWNV_MlsCQBt3YUcMDQoQIhq4I8rS2ElBX9rRjpktJBQ",
},
.zeit = .{
.url = "git+https://github.com/rockorager/zeit?ref=zig-0.15#ed2ca60db118414bda2b12df2039e33bad3b0b88",

View file

@ -113,6 +113,15 @@ pub fn receive(self: *Self, from: tp.pid_ref, m: tp.message) error{Exit}!bool {
.same, .notfound => {},
};
if (try m.match(.{ "B", input.event.press, @intFromEnum(input.mouse.BUTTON4), tp.more })) {
if (self.vt.vt.scroll(3)) tui.need_render(@src());
return true;
}
if (try m.match(.{ "B", input.event.press, @intFromEnum(input.mouse.BUTTON5), tp.more })) {
if (self.vt.vt.scroll(-3)) tui.need_render(@src());
return true;
}
if (!(try m.match(.{ "I", tp.more })
// or
// try m.match(.{ "B", tp.more }) or
@ -143,6 +152,7 @@ pub fn receive(self: *Self, from: tp.pid_ref, m: tp.message) error{Exit}!bool {
.mods = @bitCast(modifiers),
.text = if (text.len > 0) text else null,
};
self.vt.vt.scrollToBottom();
self.vt.vt.update(.{ .key_press = key }) catch |e|
std.log.err("terminal_view: input failed: {}", .{e});
tui.need_render(@src());