mod: remove min_size argument from App.start
This commit is contained in:
@@ -9,6 +9,7 @@ const log = std.log.scoped(.example);
|
|||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
errdefer |err| log.err("Application Error: {any}", .{err});
|
errdefer |err| log.err("Application Error: {any}", .{err});
|
||||||
|
|
||||||
|
// TODO: maybe create own allocator as some sort of arena allocator to have consistent memory usage
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
defer {
|
defer {
|
||||||
const deinit_status = gpa.deinit();
|
const deinit_status = gpa.deinit();
|
||||||
@@ -24,31 +25,26 @@ pub fn main() !void {
|
|||||||
|
|
||||||
var container = try App.Container.init(allocator, .{
|
var container = try App.Container.init(allocator, .{
|
||||||
.border = .{
|
.border = .{
|
||||||
.color = .green,
|
.color = .blue,
|
||||||
|
.sides = .{
|
||||||
|
.top = false,
|
||||||
|
.bottom = false,
|
||||||
|
},
|
||||||
.corners = .rounded,
|
.corners = .rounded,
|
||||||
.separator = .{ .enabled = false },
|
.separator = .{ .enabled = false },
|
||||||
},
|
},
|
||||||
.layout = .{ .gap = 10, .direction = .horizontal },
|
.layout = .{ .gap = 3, .direction = .horizontal },
|
||||||
});
|
});
|
||||||
try container.append(try App.Container.init(allocator, .{
|
try container.append(try App.Container.init(allocator, .{
|
||||||
.border = .{ .color = .light_green, .corners = .squared },
|
.border = .{ .color = .light_blue, .corners = .squared },
|
||||||
}));
|
}));
|
||||||
try container.append(try App.Container.init(allocator, .{
|
try container.append(try App.Container.init(allocator, .{
|
||||||
.border = .{ .color = .light_green, .corners = .squared },
|
.border = .{ .color = .light_blue, .corners = .squared },
|
||||||
}));
|
|
||||||
try container.append(try App.Container.init(allocator, .{
|
|
||||||
.border = .{ .color = .light_green, .corners = .squared },
|
|
||||||
}));
|
|
||||||
try container.append(try App.Container.init(allocator, .{
|
|
||||||
.border = .{ .color = .light_green, .corners = .squared },
|
|
||||||
}));
|
|
||||||
try container.append(try App.Container.init(allocator, .{
|
|
||||||
.border = .{ .color = .light_red, .corners = .squared },
|
|
||||||
}));
|
}));
|
||||||
defer container.deinit();
|
defer container.deinit();
|
||||||
|
|
||||||
// NOTE: should the min-size here be required?
|
// NOTE: should the min-size here be required?
|
||||||
try app.start(null);
|
try app.start();
|
||||||
defer app.stop() catch |err| log.err("Failed to stop application: {any}", .{err});
|
defer app.stop() catch |err| log.err("Failed to stop application: {any}", .{err});
|
||||||
|
|
||||||
// event loop
|
// event loop
|
||||||
@@ -58,14 +54,25 @@ pub fn main() !void {
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
.init => {
|
.init => {
|
||||||
if (container.handle(event)) |e| app.postEvent(e);
|
try container.handle(event);
|
||||||
continue;
|
continue; // do not render
|
||||||
},
|
},
|
||||||
.quit => break,
|
.quit => break,
|
||||||
.resize => |size| try renderer.resize(size),
|
.resize => |size| try renderer.resize(size),
|
||||||
.key => |key| {
|
.key => |key| {
|
||||||
if (key.matches(.{ .cp = 'q' }))
|
if (key.matches(.{ .cp = 'q' })) app.quit();
|
||||||
app.quit();
|
|
||||||
|
if (key.matches(.{ .cp = 'n', .mod = .{ .ctrl = true } })) {
|
||||||
|
try app.interrupt();
|
||||||
|
defer app.start() catch @panic("could not start app event loop");
|
||||||
|
var child = std.process.Child.init(&.{"hx"}, allocator);
|
||||||
|
_ = child.spawnAndWait() catch |err| app.postEvent(.{
|
||||||
|
.err = .{
|
||||||
|
.err = err,
|
||||||
|
.msg = "Spawning $EDITOR failed",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
.err => |err| {
|
.err => |err| {
|
||||||
log.err("Received {any} with message: {s}", .{ @errorName(err.err), err.msg });
|
log.err("Received {any} with message: {s}", .{ @errorName(err.err), err.msg });
|
||||||
@@ -73,9 +80,8 @@ pub fn main() !void {
|
|||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: should instead use tryPost because it may block the main loop from actually removing events from the queue, deadlocking itself
|
try container.handle(event);
|
||||||
if (container.handle(event)) |e| app.postEvent(e);
|
try renderer.render(@TypeOf(container), &container);
|
||||||
renderer.render(@TypeOf(container), &container);
|
|
||||||
try renderer.flush();
|
try renderer.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
69
src/app.zig
69
src/app.zig
@@ -44,7 +44,6 @@ pub fn App(comptime E: type) type {
|
|||||||
quit_event: std.Thread.ResetEvent = .{},
|
quit_event: std.Thread.ResetEvent = .{},
|
||||||
termios: ?std.posix.termios = null,
|
termios: ?std.posix.termios = null,
|
||||||
attached_handler: bool = false,
|
attached_handler: bool = false,
|
||||||
min_size: ?Size = null,
|
|
||||||
prev_size: Size = .{ .cols = 0, .rows = 0 },
|
prev_size: Size = .{ .cols = 0, .rows = 0 },
|
||||||
|
|
||||||
pub const SignalHandler = struct {
|
pub const SignalHandler = struct {
|
||||||
@@ -52,8 +51,7 @@ pub fn App(comptime E: type) type {
|
|||||||
callback: *const fn (context: *anyopaque) void,
|
callback: *const fn (context: *anyopaque) void,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn start(this: *@This(), min_size: ?Size) !void {
|
pub fn start(this: *@This()) !void {
|
||||||
this.min_size = min_size;
|
|
||||||
if (this.thread) |_| return;
|
if (this.thread) |_| return;
|
||||||
|
|
||||||
if (!this.attached_handler) {
|
if (!this.attached_handler) {
|
||||||
@@ -69,6 +67,9 @@ pub fn App(comptime E: type) type {
|
|||||||
.callback = @This().winsizeCallback,
|
.callback = @This().winsizeCallback,
|
||||||
});
|
});
|
||||||
this.attached_handler = true;
|
this.attached_handler = true;
|
||||||
|
|
||||||
|
// post init event (as the very first element to be in the queue - event loop)
|
||||||
|
this.postEvent(.init);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.quit_event.reset();
|
this.quit_event.reset();
|
||||||
@@ -76,14 +77,16 @@ pub fn App(comptime E: type) type {
|
|||||||
|
|
||||||
var termios: std.posix.termios = undefined;
|
var termios: std.posix.termios = undefined;
|
||||||
try terminal.enableRawMode(&termios);
|
try terminal.enableRawMode(&termios);
|
||||||
if (this.termios) |_| {} else {
|
if (this.termios) |_| {} else this.termios = termios;
|
||||||
this.termios = termios;
|
|
||||||
}
|
|
||||||
try terminal.saveScreen();
|
try terminal.saveScreen();
|
||||||
try terminal.enterAltScreen();
|
try terminal.enterAltScreen();
|
||||||
try terminal.hideCursor();
|
try terminal.hideCursor();
|
||||||
// post init event (as the very first element to be in the queue - event loop)
|
|
||||||
this.postEvent(.init);
|
// send initial size afterwards
|
||||||
|
const size = terminal.getTerminalSize();
|
||||||
|
this.postEvent(.{ .resize = size });
|
||||||
|
this.prev_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn interrupt(this: *@This()) !void {
|
pub fn interrupt(this: *@This()) !void {
|
||||||
@@ -127,15 +130,6 @@ pub fn App(comptime E: type) type {
|
|||||||
fn winsizeCallback(ptr: *anyopaque) void {
|
fn winsizeCallback(ptr: *anyopaque) void {
|
||||||
const this: *@This() = @ptrCast(@alignCast(ptr));
|
const this: *@This() = @ptrCast(@alignCast(ptr));
|
||||||
const size = terminal.getTerminalSize();
|
const size = terminal.getTerminalSize();
|
||||||
// check for minimal size (if any was provided)
|
|
||||||
if (this.min_size) |min_size| {
|
|
||||||
if (size.cols < min_size.cols or size.rows < min_size.rows) {
|
|
||||||
this.postEvent(.{
|
|
||||||
.err = .{ .err = error.InsufficientSize, .msg = "Terminal size is too small for the requested minimal size" },
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (size.cols != this.prev_size.cols or size.rows != this.prev_size.rows) {
|
if (size.cols != this.prev_size.cols or size.rows != this.prev_size.rows) {
|
||||||
this.postEvent(.{ .resize = size });
|
this.postEvent(.{ .resize = size });
|
||||||
this.prev_size = size;
|
this.prev_size = size;
|
||||||
@@ -161,19 +155,7 @@ pub fn App(comptime E: type) type {
|
|||||||
// send initial terminal size
|
// send initial terminal size
|
||||||
// changes are handled by the winch signal handler
|
// changes are handled by the winch signal handler
|
||||||
// see `App.start` and `App.registerWinch` for details
|
// see `App.start` and `App.registerWinch` for details
|
||||||
{
|
{}
|
||||||
// TODO: what should happen if the initial window size is too small?
|
|
||||||
// -> currently the first render call will then crash the application (which happens anyway)
|
|
||||||
const size = terminal.getTerminalSize();
|
|
||||||
if (this.min_size) |min_size| {
|
|
||||||
if (size.cols < min_size.cols or size.rows < min_size.rows) {
|
|
||||||
this.postEvent(.{
|
|
||||||
.err = .{ .err = error.InsufficientSize, .msg = "Terminal size is too small for the requested minimal size" },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.postEvent(.{ .resize = size });
|
|
||||||
}
|
|
||||||
|
|
||||||
// thread to read user inputs
|
// thread to read user inputs
|
||||||
var buf: [256]u8 = undefined;
|
var buf: [256]u8 = undefined;
|
||||||
@@ -185,9 +167,8 @@ pub fn App(comptime E: type) type {
|
|||||||
if (buf[0] == 0x1b and read_bytes > 1) {
|
if (buf[0] == 0x1b and read_bytes > 1) {
|
||||||
switch (buf[1]) {
|
switch (buf[1]) {
|
||||||
0x4F => { // ss3
|
0x4F => { // ss3
|
||||||
if (read_bytes < 3) {
|
if (read_bytes < 3) continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
const key: ?Key = switch (buf[2]) {
|
const key: ?Key = switch (buf[2]) {
|
||||||
0x1B => null,
|
0x1B => null,
|
||||||
'A' => .{ .cp = Key.up },
|
'A' => .{ .cp = Key.up },
|
||||||
@@ -203,14 +184,11 @@ pub fn App(comptime E: type) type {
|
|||||||
'S' => .{ .cp = Key.f4 },
|
'S' => .{ .cp = Key.f4 },
|
||||||
else => null,
|
else => null,
|
||||||
};
|
};
|
||||||
if (key) |k| {
|
if (key) |k| this.postEvent(.{ .key = k });
|
||||||
this.postEvent(.{ .key = k });
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
0x5B => { // csi
|
0x5B => { // csi
|
||||||
if (read_bytes < 3) {
|
if (read_bytes < 3) continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// We start iterating at index 2 to get past the '['
|
// We start iterating at index 2 to get past the '['
|
||||||
const sequence = for (buf[2..], 2..) |b, i| {
|
const sequence = for (buf[2..], 2..) |b, i| {
|
||||||
switch (b) {
|
switch (b) {
|
||||||
@@ -309,15 +287,6 @@ pub fn App(comptime E: type) type {
|
|||||||
.rows = std.fmt.parseUnsigned(u16, height_char, 10) catch break,
|
.rows = std.fmt.parseUnsigned(u16, height_char, 10) catch break,
|
||||||
.cols = std.fmt.parseUnsigned(u16, width_char, 10) catch break,
|
.cols = std.fmt.parseUnsigned(u16, width_char, 10) catch break,
|
||||||
};
|
};
|
||||||
// check for minimal size (if any was provided)
|
|
||||||
if (this.min_size) |min_size| {
|
|
||||||
if (size.cols < min_size.cols or size.rows < min_size.rows) {
|
|
||||||
this.postEvent(.{
|
|
||||||
.err = .{ .err = error.InsufficientSize, .msg = "Terminal size is too small for the requested minimal size" },
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (size.cols != this.prev_size.cols or size.rows != this.prev_size.rows) {
|
if (size.cols != this.prev_size.cols or size.rows != this.prev_size.rows) {
|
||||||
this.postEvent(.{ .resize = size });
|
this.postEvent(.{ .resize = size });
|
||||||
this.prev_size = size;
|
this.prev_size = size;
|
||||||
@@ -355,9 +324,7 @@ pub fn App(comptime E: type) type {
|
|||||||
0x7f => .{ .cp = Key.backspace },
|
0x7f => .{ .cp = Key.backspace },
|
||||||
else => {
|
else => {
|
||||||
var iter = terminal.code_point.Iterator{ .bytes = buf[0..read_bytes] };
|
var iter = terminal.code_point.Iterator{ .bytes = buf[0..read_bytes] };
|
||||||
while (iter.next()) |cp| {
|
while (iter.next()) |cp| this.postEvent(.{ .key = .{ .cp = cp.code } });
|
||||||
this.postEvent(.{ .key = .{ .cp = cp.code } });
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -52,32 +52,36 @@ pub const Border = struct {
|
|||||||
// render top and bottom border
|
// render top and bottom border
|
||||||
for (0..size.cols) |col| {
|
for (0..size.cols) |col| {
|
||||||
const last_row = (size.rows - 1) * size.cols;
|
const last_row = (size.rows - 1) * size.cols;
|
||||||
if (col == 0) {
|
if (this.sides.left and col == 0) {
|
||||||
// top left corner
|
// top left corner
|
||||||
cells[col].cp = frame[0];
|
if (this.sides.top) cells[col].cp = frame[0];
|
||||||
// bottom left corner
|
// bottom left corner
|
||||||
cells[last_row + col].cp = frame[4];
|
if (this.sides.bottom) cells[last_row + col].cp = frame[4];
|
||||||
} else if (col == size.cols - 1) {
|
} else if (this.sides.right and col == size.cols - 1) {
|
||||||
// top right corner
|
// top right corner
|
||||||
cells[col].cp = frame[2];
|
if (this.sides.top) cells[col].cp = frame[2];
|
||||||
// bottom left corner
|
// bottom left corner
|
||||||
cells[last_row + col].cp = frame[5];
|
if (this.sides.bottom) cells[last_row + col].cp = frame[5];
|
||||||
} else {
|
} else {
|
||||||
// top side
|
// top side
|
||||||
cells[col].cp = frame[1];
|
if (this.sides.top) cells[col].cp = frame[1];
|
||||||
// bottom side
|
// bottom side
|
||||||
cells[last_row + col].cp = frame[1];
|
if (this.sides.bottom) cells[last_row + col].cp = frame[1];
|
||||||
}
|
}
|
||||||
cells[col].style.fg = this.color;
|
if (this.sides.top) cells[col].style.fg = this.color;
|
||||||
cells[last_row + col].style.fg = this.color;
|
if (this.sides.bottom) cells[last_row + col].style.fg = this.color;
|
||||||
}
|
}
|
||||||
// render left and right border
|
// render left and right border
|
||||||
for (1..size.rows - 1) |row| {
|
for (1..size.rows - 1) |row| {
|
||||||
const idx = (row * size.cols);
|
const idx = (row * size.cols);
|
||||||
cells[idx].cp = frame[3]; // left
|
if (this.sides.left) {
|
||||||
cells[idx].style.fg = this.color;
|
cells[idx].cp = frame[3]; // left
|
||||||
cells[idx + size.cols - 1].cp = frame[3]; // right
|
cells[idx].style.fg = this.color;
|
||||||
cells[idx + size.cols - 1].style.fg = this.color;
|
}
|
||||||
|
if (this.sides.right) {
|
||||||
|
cells[idx + size.cols - 1].cp = frame[3]; // right
|
||||||
|
cells[idx + size.cols - 1].style.fg = this.color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: the separator should be rendered regardless of the gap
|
// TODO: the separator should be rendered regardless of the gap
|
||||||
@@ -258,7 +262,7 @@ pub fn Container(comptime Event: type) type {
|
|||||||
try this.elements.append(element);
|
try this.elements.append(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle(this: *@This(), event: Event) ?Event {
|
pub fn handle(this: *@This(), event: Event) !void {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
.init => log.debug(".init event", .{}),
|
.init => log.debug(".init event", .{}),
|
||||||
.resize => |size| resize: {
|
.resize => |size| resize: {
|
||||||
@@ -359,29 +363,15 @@ pub fn Container(comptime Event: type) type {
|
|||||||
element_size.anchor.col += 1;
|
element_size.anchor.col += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: adjust size according to the layout of the `Container`
|
try element.handle(.{ .resize = element_size });
|
||||||
if (element.handle(.{ .resize = element_size })) |e| {
|
|
||||||
_ = e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
},
|
},
|
||||||
else => {},
|
else => for (this.elements.items) |*element| try element.handle(event),
|
||||||
}
|
}
|
||||||
for (this.elements.items) |*element| {
|
|
||||||
if (element.handle(event)) |e| {
|
|
||||||
// TODO: if only the top level container returns a single
|
|
||||||
// event (i.e. as a reaction to a certain other event) what
|
|
||||||
// should happen to potential other events?
|
|
||||||
_ = e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contents(this: *const @This()) []const Cell {
|
pub fn contents(this: *const @This()) ![]const Cell {
|
||||||
// TODO: use the size and the corresponding contents to determine what should be show in form of a `Cell` array
|
const cells = try this.allocator.alloc(Cell, this.size.cols * this.size.rows);
|
||||||
const cells = this.allocator.alloc(Cell, this.size.cols * this.size.rows) catch @panic("Container::contents: Out of memory.");
|
|
||||||
@memset(cells, .{}); // reset all cells
|
@memset(cells, .{}); // reset all cells
|
||||||
this.properties.border.contents(cells, this.size, this.properties.layout, @truncate(this.elements.items.len));
|
this.properties.border.contents(cells, this.size, this.properties.layout, @truncate(this.elements.items.len));
|
||||||
return cells;
|
return cells;
|
||||||
|
|||||||
@@ -1,12 +1,3 @@
|
|||||||
//! Renderer which holds the screen to compare with the previous screen for efficient rendering.
|
|
||||||
//! Each renderer should at least implement these functions:
|
|
||||||
//! - resize(this: *@This(), size: Size) void {}
|
|
||||||
//! - clear(this: *@This(), size: Size) !void {}
|
|
||||||
//! - render(this: *@This(), size: Size, contents: []u8) !void {}
|
|
||||||
//!
|
|
||||||
//! Each `Renderer` should be able to be used interchangeable without having to
|
|
||||||
//! change any code of any `Layout` or `Widget`. The only change should be the
|
|
||||||
//! passed type to `zterm.App` _R_ parameter.
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const terminal = @import("terminal.zig");
|
const terminal = @import("terminal.zig");
|
||||||
|
|
||||||
@@ -45,14 +36,12 @@ pub const Buffered = struct {
|
|||||||
log.debug("renderer::resize", .{});
|
log.debug("renderer::resize", .{});
|
||||||
defer this.size = size;
|
defer this.size = size;
|
||||||
|
|
||||||
if (this.size.cols >= size.cols or this.size.rows >= size.rows) {
|
if (!this.created) {
|
||||||
if (!this.created) {
|
this.screen = this.allocator.alloc(Cell, size.cols * size.rows) catch @panic("render.zig: Out of memory.");
|
||||||
this.screen = this.allocator.alloc(Cell, size.cols * size.rows) catch @panic("render.zig: Out of memory.");
|
@memset(this.screen, .{});
|
||||||
@memset(this.screen, .{});
|
this.virtual_screen = this.allocator.alloc(Cell, size.cols * size.rows) catch @panic("render.zig: Out of memory.");
|
||||||
this.virtual_screen = this.allocator.alloc(Cell, size.cols * size.rows) catch @panic("render.zig: Out of memory.");
|
@memset(this.virtual_screen, .{});
|
||||||
@memset(this.virtual_screen, .{});
|
this.created = true;
|
||||||
this.created = true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.allocator.free(this.screen);
|
this.allocator.free(this.screen);
|
||||||
this.screen = this.allocator.alloc(Cell, size.cols * size.rows) catch @panic("render.zig: Out of memory.");
|
this.screen = this.allocator.alloc(Cell, size.cols * size.rows) catch @panic("render.zig: Out of memory.");
|
||||||
@@ -72,9 +61,9 @@ pub const Buffered = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Render provided cells at size (anchor and dimension) into the *virtual screen*.
|
/// Render provided cells at size (anchor and dimension) into the *virtual screen*.
|
||||||
pub fn render(this: *@This(), comptime T: type, container: *T) void {
|
pub fn render(this: *@This(), comptime T: type, container: *T) !void {
|
||||||
const size: Size = container.size;
|
const size: Size = container.size;
|
||||||
const cells: []const Cell = container.contents();
|
const cells: []const Cell = try container.contents();
|
||||||
|
|
||||||
if (cells.len == 0) return;
|
if (cells.len == 0) return;
|
||||||
|
|
||||||
@@ -93,10 +82,11 @@ pub const Buffered = struct {
|
|||||||
if (cells.len == idx) break :blk;
|
if (cells.len == idx) break :blk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// free immediately
|
||||||
container.allocator.free(cells);
|
container.allocator.free(cells);
|
||||||
|
|
||||||
for (container.elements.items) |*element| {
|
for (container.elements.items) |*element| {
|
||||||
this.render(T, element);
|
try this.render(T, element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,10 +102,9 @@ pub const Buffered = struct {
|
|||||||
const idx = (row * this.size.cols) + col;
|
const idx = (row * this.size.cols) + col;
|
||||||
const cs = s[idx];
|
const cs = s[idx];
|
||||||
const cvs = vs[idx];
|
const cvs = vs[idx];
|
||||||
if (cs.eql(cvs))
|
if (cs.eql(cvs)) continue;
|
||||||
continue;
|
|
||||||
// render differences found in virtual screen
|
// render differences found in virtual screen
|
||||||
// TODO: improve the writing speed (many unnecessary writes (i.e. the style for every character..))
|
|
||||||
try terminal.setCursorPosition(.{ .row = @truncate(row + 1), .col = @truncate(col + 1) });
|
try terminal.setCursorPosition(.{ .row = @truncate(row + 1), .col = @truncate(col + 1) });
|
||||||
try cvs.value(writer);
|
try cvs.value(writer);
|
||||||
// update screen to be the virtual screen for the next frame
|
// update screen to be the virtual screen for the next frame
|
||||||
|
|||||||
Reference in New Issue
Block a user