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