More IO events

This commit is contained in:
Mitchell Hashimoto
2022-11-04 22:13:37 -07:00
parent 1a7b9f7465
commit 989046a06c
5 changed files with 63 additions and 5 deletions

View File

@@ -1,8 +1,11 @@
const std = @import("std");
const renderer = @import("../renderer.zig");
const terminal = @import("../terminal/main.zig");
/// The messages that can be sent to an IO thread.
pub const IO = union(enum) {
pub const SmallWriteArray = [22]u8;
/// Resize the window.
resize: struct {
grid_size: renderer.GridSize,
@@ -11,7 +14,19 @@ pub const IO = union(enum) {
/// Clear the selection
clear_selection: void,
//
// /// Scroll the viewport
// scroll_viewport: terminal.Terminal.ScrollViewport,
/// Scroll the viewport
scroll_viewport: terminal.Terminal.ScrollViewport,
/// Write where the data fits in the union.
small_write: struct {
data: [22]u8,
len: u8,
},
};
test {
// Ensure we don't grow our IO message size without explicitly wanting to.
const testing = std.testing;
try testing.expectEqual(@as(usize, 24), @sizeOf(IO));
}