feat: add libvaxis renderer
This commit is contained in:
parent
b15fa47f30
commit
1cd3cb17ce
32 changed files with 1559 additions and 516 deletions
|
@ -4,7 +4,7 @@ const root = @import("root");
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../tui.zig");
|
||||
const command = @import("../../command.zig");
|
||||
|
@ -250,7 +250,7 @@ fn insert_code_point(self: *Self, c: u32) tp.result {
|
|||
if (self.input.items.len + 4 > input_buffer_size)
|
||||
try self.flush_input();
|
||||
var buf: [6]u8 = undefined;
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
self.input.appendSlice(buf[0..bytes]) catch |e| return tp.exit_error(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const root = @import("root");
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../../tui.zig");
|
||||
const command = @import("../../../command.zig");
|
||||
|
@ -251,7 +251,7 @@ fn insert_code_point(self: *Self, c: u32) tp.result {
|
|||
if (self.input.items.len + 4 > input_buffer_size)
|
||||
try self.flush_input();
|
||||
var buf: [6]u8 = undefined;
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
self.input.appendSlice(buf[0..bytes]) catch |e| return tp.exit_error(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const root = @import("root");
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../../tui.zig");
|
||||
const command = @import("../../../command.zig");
|
||||
|
@ -453,7 +453,7 @@ fn insert_code_point(self: *Self, c: u32) tp.result {
|
|||
if (self.input.items.len + 4 > input_buffer_size)
|
||||
try self.flush_input();
|
||||
var buf: [6]u8 = undefined;
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
self.input.appendSlice(buf[0..bytes]) catch |e| return tp.exit_error(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const root = @import("root");
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../../tui.zig");
|
||||
const command = @import("../../../command.zig");
|
||||
|
@ -411,7 +411,7 @@ fn insert_code_point(self: *Self, c: u32) tp.result {
|
|||
if (self.input.items.len + 4 > input_buffer_size)
|
||||
try self.flush_input();
|
||||
var buf: [6]u8 = undefined;
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
self.input.appendSlice(buf[0..bytes]) catch |e| return tp.exit_error(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const tp = @import("thespian");
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../tui.zig");
|
||||
const mainview = @import("../../mainview.zig");
|
||||
|
@ -161,7 +161,7 @@ fn mapRelease(self: *Self, keypress: u32, _: u32, _: u32) tp.result {
|
|||
fn insert_code_point(self: *Self, c: u32) tp.result {
|
||||
if (self.input.len + 16 > self.buf.len)
|
||||
try self.flush_input();
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, self.buf[self.input.len..]) catch |e| return tp.exit_error(e);
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, self.buf[self.input.len..]) catch |e| return tp.exit_error(e);
|
||||
self.input = self.buf[0 .. self.input.len + bytes];
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const tp = @import("thespian");
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../tui.zig");
|
||||
const mainview = @import("../../mainview.zig");
|
||||
|
@ -158,7 +158,7 @@ fn mapRelease(self: *Self, keypress: u32, _: u32, _: u32) tp.result {
|
|||
fn insert_code_point(self: *Self, c: u32) tp.result {
|
||||
if (self.input.len + 16 > self.buf.len)
|
||||
try self.flush_input();
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, self.buf[self.input.len..]) catch |e| return tp.exit_error(e);
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, self.buf[self.input.len..]) catch |e| return tp.exit_error(e);
|
||||
self.input = self.buf[0 .. self.input.len + bytes];
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const tp = @import("thespian");
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../tui.zig");
|
||||
const mainview = @import("../../mainview.zig");
|
||||
|
@ -114,7 +114,7 @@ fn execute_operation(self: *Self, c: u32) void {
|
|||
},
|
||||
};
|
||||
var buf: [6]u8 = undefined;
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, &buf) catch return;
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, &buf) catch return;
|
||||
command.executeName(cmd, command.fmt(.{buf[0..bytes]})) catch {};
|
||||
command.executeName("exit_mini_mode", .{}) catch {};
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ const tp = @import("thespian");
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../tui.zig");
|
||||
const mainview = @import("../../mainview.zig");
|
||||
|
@ -125,7 +125,7 @@ fn mapRelease(_: *Self, _: u32, _: u32, _: u32) tp.result {}
|
|||
|
||||
fn insert_code_point(self: *Self, c: u32) tp.result {
|
||||
var buf: [32]u8 = undefined;
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
self.file_path.appendSlice(buf[0..bytes]) catch |e| return tp.exit_error(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ const planeutils = @import("renderer").planeutils;
|
|||
const key = @import("renderer").input.key;
|
||||
const mod = @import("renderer").input.modifier;
|
||||
const event_type = @import("renderer").input.event_type;
|
||||
const egc_ = @import("renderer").egc;
|
||||
const ucs32_to_utf8 = @import("renderer").ucs32_to_utf8;
|
||||
|
||||
const tui = @import("../../tui.zig");
|
||||
const command = @import("../../command.zig");
|
||||
|
@ -89,13 +89,13 @@ fn on_render_menu(_: *Self, button: *Button.State(*Menu.State(*Self)), theme: *c
|
|||
var len = cbor.decodeArrayHeader(&iter) catch return false;
|
||||
while (len > 0) : (len -= 1) {
|
||||
if (cbor.matchValue(&iter, cbor.extract(&index)) catch break) {
|
||||
render_cell(button.plane, 0, index + 1, theme.editor_match) catch break;
|
||||
render_cell(&button.plane, 0, index + 1, theme.editor_match) catch break;
|
||||
} else break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
fn render_cell(plane: Plane, y: usize, x: usize, style: Widget.Theme.Style) !void {
|
||||
fn render_cell(plane: *Plane, y: usize, x: usize, style: Widget.Theme.Style) !void {
|
||||
plane.cursor_move_yx(@intCast(y), @intCast(x)) catch return;
|
||||
var cell = plane.cell_init();
|
||||
_ = plane.at_cursor_cell(&cell) catch return;
|
||||
|
@ -313,7 +313,7 @@ fn delete_code_point(self: *Self) tp.result {
|
|||
|
||||
fn insert_code_point(self: *Self, c: u32) tp.result {
|
||||
var buf: [6]u8 = undefined;
|
||||
const bytes = egc_.ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
const bytes = ucs32_to_utf8(&[_]u32{c}, &buf) catch |e| return tp.exit_error(e);
|
||||
self.inputbox.text.appendSlice(buf[0..bytes]) catch |e| return tp.exit_error(e);
|
||||
self.inputbox.cursor = self.inputbox.text.items.len;
|
||||
return self.start_query();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue