Merge branch 'main' into dmehala/conemu-osc9

This commit is contained in:
Damien Mehala
2025-01-05 21:58:45 +01:00
committed by GitHub
96 changed files with 4026 additions and 1301 deletions

View File

@@ -14,6 +14,7 @@ const input = @import("../input.zig");
const renderer = @import("../renderer.zig");
const terminal = @import("../terminal/main.zig");
const inspector = @import("main.zig");
const units = @import("units.zig");
/// The window names. These are used with docking so we need to have access.
const window_cell = "Cell";
@@ -440,7 +441,7 @@ fn renderScreenWindow(self: *Inspector) void {
}
{
_ = cimgui.c.igTableSetColumnIndex(1);
cimgui.c.igText("%d bytes", kitty_images.total_bytes);
cimgui.c.igText("%d bytes (%d KiB)", kitty_images.total_bytes, units.toKibiBytes(kitty_images.total_bytes));
}
}
@@ -452,7 +453,7 @@ fn renderScreenWindow(self: *Inspector) void {
}
{
_ = cimgui.c.igTableSetColumnIndex(1);
cimgui.c.igText("%d bytes", kitty_images.total_limit);
cimgui.c.igText("%d bytes (%d KiB)", kitty_images.total_limit, units.toKibiBytes(kitty_images.total_limit));
}
}
@@ -518,7 +519,7 @@ fn renderScreenWindow(self: *Inspector) void {
}
{
_ = cimgui.c.igTableSetColumnIndex(1);
cimgui.c.igText("%d bytes", pages.page_size);
cimgui.c.igText("%d bytes (%d KiB)", pages.page_size, units.toKibiBytes(pages.page_size));
}
}
@@ -530,7 +531,7 @@ fn renderScreenWindow(self: *Inspector) void {
}
{
_ = cimgui.c.igTableSetColumnIndex(1);
cimgui.c.igText("%d bytes", pages.maxSize());
cimgui.c.igText("%d bytes (%d KiB)", pages.maxSize(), units.toKibiBytes(pages.maxSize()));
}
}
@@ -724,7 +725,7 @@ fn renderSizeWindow(self: *Inspector) void {
{
_ = cimgui.c.igTableSetColumnIndex(1);
cimgui.c.igText(
"%d pt",
"%.2f pt",
self.surface.font_size.points,
);
}

View File

@@ -3,6 +3,8 @@ const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const cimgui = @import("cimgui");
const terminal = @import("../terminal/main.zig");
const inspector = @import("main.zig");
const units = @import("units.zig");
pub fn render(page: *const terminal.Page) void {
cimgui.c.igPushID_Ptr(page);
@@ -25,7 +27,7 @@ pub fn render(page: *const terminal.Page) void {
}
{
_ = cimgui.c.igTableSetColumnIndex(1);
cimgui.c.igText("%d bytes", page.memory.len);
cimgui.c.igText("%d bytes (%d KiB)", page.memory.len, units.toKibiBytes(page.memory.len));
cimgui.c.igText("%d VM pages", page.memory.len / std.mem.page_size);
}
}

View File

@@ -35,7 +35,7 @@ pub const VTEvent = struct {
const Kind = enum { print, execute, csi, esc, osc, dcs, apc };
const Metadata = std.StringHashMap([:0]const u8);
/// Initiaze the event information for the given parser action.
/// Initialize the event information for the given parser action.
pub fn init(
alloc: Allocator,
surface: *Surface,
@@ -208,6 +208,20 @@ pub const VTEvent = struct {
);
},
.Union => |info| {
const Tag = info.tag_type orelse @compileError("Unions must have a tag");
const tag_name = @tagName(@as(Tag, v));
inline for (info.fields) |field| {
if (std.mem.eql(u8, field.name, tag_name)) {
if (field.type == void) {
break try md.put("data", tag_name);
} else {
break try encodeMetadataSingle(alloc, md, tag_name, @field(v, field.name));
}
}
}
},
else => {
@compileLog(T);
@compileError("unsupported type, see log");

3
src/inspector/units.zig Normal file
View File

@@ -0,0 +1,3 @@
pub fn toKibiBytes(bytes: usize) usize {
return bytes / 1024;
}