mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
inspector: add sequence number to termio
This commit is contained in:
@ -1046,6 +1046,7 @@ fn renderKeyboardWindow(self: *Inspector) void {
|
||||
var it = self.key_events.iterator(.forward);
|
||||
while (it.next()) |v| v.deinit(self.surface.alloc);
|
||||
self.key_events.clear();
|
||||
self.vt_stream.handler.current_seq = 1;
|
||||
}
|
||||
|
||||
cimgui.c.igSeparator();
|
||||
@ -1131,7 +1132,7 @@ fn renderTermioWindow(self: *Inspector) void {
|
||||
|
||||
_ = cimgui.c.igBeginTable(
|
||||
"table_vt_events",
|
||||
2,
|
||||
3,
|
||||
cimgui.c.ImGuiTableFlags_RowBg |
|
||||
cimgui.c.ImGuiTableFlags_Borders,
|
||||
.{ .x = 0, .y = 0 },
|
||||
@ -1139,6 +1140,12 @@ fn renderTermioWindow(self: *Inspector) void {
|
||||
);
|
||||
defer cimgui.c.igEndTable();
|
||||
|
||||
cimgui.c.igTableSetupColumn(
|
||||
"Seq",
|
||||
cimgui.c.ImGuiTableColumnFlags_WidthFixed,
|
||||
0,
|
||||
0,
|
||||
);
|
||||
cimgui.c.igTableSetupColumn(
|
||||
"Kind",
|
||||
cimgui.c.ImGuiTableColumnFlags_WidthFixed,
|
||||
@ -1159,9 +1166,11 @@ fn renderTermioWindow(self: *Inspector) void {
|
||||
defer cimgui.c.igPopID();
|
||||
|
||||
cimgui.c.igTableNextRow(cimgui.c.ImGuiTableRowFlags_None, 0);
|
||||
_ = cimgui.c.igTableSetColumnIndex(0);
|
||||
_ = cimgui.c.igTableNextColumn();
|
||||
cimgui.c.igText("%d", ev.seq);
|
||||
_ = cimgui.c.igTableNextColumn();
|
||||
cimgui.c.igText("%s", @tagName(ev.kind).ptr);
|
||||
_ = cimgui.c.igTableSetColumnIndex(1);
|
||||
_ = cimgui.c.igTableNextColumn();
|
||||
cimgui.c.igText("%s", ev.str.ptr);
|
||||
}
|
||||
} // table
|
||||
|
@ -13,6 +13,9 @@ pub const VTEventRing = CircBuf(VTEvent, undefined);
|
||||
|
||||
/// VT event
|
||||
pub const VTEvent = struct {
|
||||
/// Sequence number, just monotonically increasing.
|
||||
seq: usize = 1,
|
||||
|
||||
/// Kind of event, for filtering
|
||||
kind: Kind,
|
||||
|
||||
@ -69,6 +72,9 @@ pub const VTHandler = struct {
|
||||
/// True if the handler is currently recording.
|
||||
active: bool = true,
|
||||
|
||||
/// Current sequence number
|
||||
current_seq: usize = 1,
|
||||
|
||||
/// Exclude certain actions by tag.
|
||||
filter_exclude: ActionTagSet = ActionTagSet.initMany(&.{.print}),
|
||||
filter_text: *cimgui.c.ImGuiTextFilter,
|
||||
@ -106,10 +112,13 @@ pub const VTHandler = struct {
|
||||
// Build our event
|
||||
const alloc = self.surface.alloc;
|
||||
var ev = try VTEvent.init(alloc, action);
|
||||
ev.seq = self.current_seq;
|
||||
self.current_seq +%= 1;
|
||||
errdefer ev.deinit(alloc);
|
||||
|
||||
// Check if the event passes the filter
|
||||
if (!ev.passFilter(self.filter_text)) {
|
||||
self.current_seq -= 1;
|
||||
ev.deinit(alloc);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user