mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
inspector: termio pause/resume
This commit is contained in:
@ -1094,8 +1094,18 @@ fn renderTermioWindow(self: *Inspector) void {
|
|||||||
cimgui.c.ImGuiWindowFlags_NoFocusOnAppearing,
|
cimgui.c.ImGuiWindowFlags_NoFocusOnAppearing,
|
||||||
)) return;
|
)) return;
|
||||||
|
|
||||||
list: {
|
|
||||||
const popup_filter = "Filter";
|
const popup_filter = "Filter";
|
||||||
|
|
||||||
|
list: {
|
||||||
|
const pause_play: [:0]const u8 = if (self.vt_stream.handler.active)
|
||||||
|
"Pause##pause_play"
|
||||||
|
else
|
||||||
|
"Resume##pause_play";
|
||||||
|
if (cimgui.c.igButton(pause_play.ptr, .{ .x = 0, .y = 0 })) {
|
||||||
|
self.vt_stream.handler.active = !self.vt_stream.handler.active;
|
||||||
|
}
|
||||||
|
|
||||||
|
cimgui.c.igSameLine(0, cimgui.c.igGetStyle().*.ItemInnerSpacing.x);
|
||||||
if (cimgui.c.igButton("Filter", .{ .x = 0, .y = 0 })) {
|
if (cimgui.c.igButton("Filter", .{ .x = 0, .y = 0 })) {
|
||||||
cimgui.c.igOpenPopup_Str(
|
cimgui.c.igOpenPopup_Str(
|
||||||
popup_filter,
|
popup_filter,
|
||||||
@ -1103,6 +1113,59 @@ fn renderTermioWindow(self: *Inspector) void {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!self.vt_events.empty()) {
|
||||||
|
cimgui.c.igSameLine(0, cimgui.c.igGetStyle().*.ItemInnerSpacing.x);
|
||||||
|
if (cimgui.c.igButton("Clear", .{ .x = 0, .y = 0 })) {
|
||||||
|
var it = self.vt_events.iterator(.forward);
|
||||||
|
while (it.next()) |v| v.deinit(self.surface.alloc);
|
||||||
|
self.vt_events.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.vt_events.empty()) {
|
||||||
|
cimgui.c.igText("Waiting for events...");
|
||||||
|
break :list;
|
||||||
|
}
|
||||||
|
|
||||||
|
cimgui.c.igSeparator();
|
||||||
|
|
||||||
|
_ = cimgui.c.igBeginTable(
|
||||||
|
"table_vt_events",
|
||||||
|
2,
|
||||||
|
cimgui.c.ImGuiTableFlags_RowBg |
|
||||||
|
cimgui.c.ImGuiTableFlags_Borders,
|
||||||
|
.{ .x = 0, .y = 0 },
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
defer cimgui.c.igEndTable();
|
||||||
|
|
||||||
|
cimgui.c.igTableSetupColumn(
|
||||||
|
"Kind",
|
||||||
|
cimgui.c.ImGuiTableColumnFlags_WidthFixed,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
cimgui.c.igTableSetupColumn(
|
||||||
|
"Description",
|
||||||
|
cimgui.c.ImGuiTableColumnFlags_WidthStretch,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
|
||||||
|
var it = self.vt_events.iterator(.reverse);
|
||||||
|
while (it.next()) |ev| {
|
||||||
|
// Need to push an ID so that our selectable is unique.
|
||||||
|
cimgui.c.igPushID_Ptr(ev);
|
||||||
|
defer cimgui.c.igPopID();
|
||||||
|
|
||||||
|
cimgui.c.igTableNextRow(cimgui.c.ImGuiTableRowFlags_None, 0);
|
||||||
|
_ = cimgui.c.igTableSetColumnIndex(0);
|
||||||
|
cimgui.c.igText("%s", @tagName(ev.kind).ptr);
|
||||||
|
_ = cimgui.c.igTableSetColumnIndex(1);
|
||||||
|
cimgui.c.igText("%s", ev.str.ptr);
|
||||||
|
}
|
||||||
|
} // table
|
||||||
|
|
||||||
if (cimgui.c.igBeginPopupModal(
|
if (cimgui.c.igBeginPopupModal(
|
||||||
popup_filter,
|
popup_filter,
|
||||||
null,
|
null,
|
||||||
@ -1158,57 +1221,4 @@ fn renderTermioWindow(self: *Inspector) void {
|
|||||||
cimgui.c.igCloseCurrentPopup();
|
cimgui.c.igCloseCurrentPopup();
|
||||||
}
|
}
|
||||||
} // filter popup
|
} // filter popup
|
||||||
|
|
||||||
if (!self.vt_events.empty()) {
|
|
||||||
cimgui.c.igSameLine(0, cimgui.c.igGetStyle().*.ItemInnerSpacing.x);
|
|
||||||
if (cimgui.c.igButton("Clear", .{ .x = 0, .y = 0 })) {
|
|
||||||
var it = self.vt_events.iterator(.forward);
|
|
||||||
while (it.next()) |v| v.deinit(self.surface.alloc);
|
|
||||||
self.vt_events.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.vt_events.empty()) {
|
|
||||||
cimgui.c.igText("Waiting for events...");
|
|
||||||
break :list;
|
|
||||||
}
|
|
||||||
|
|
||||||
cimgui.c.igSeparator();
|
|
||||||
|
|
||||||
_ = cimgui.c.igBeginTable(
|
|
||||||
"table_vt_events",
|
|
||||||
2,
|
|
||||||
cimgui.c.ImGuiTableFlags_RowBg |
|
|
||||||
cimgui.c.ImGuiTableFlags_Borders,
|
|
||||||
.{ .x = 0, .y = 0 },
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
defer cimgui.c.igEndTable();
|
|
||||||
|
|
||||||
cimgui.c.igTableSetupColumn(
|
|
||||||
"Kind",
|
|
||||||
cimgui.c.ImGuiTableColumnFlags_WidthFixed,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
cimgui.c.igTableSetupColumn(
|
|
||||||
"Description",
|
|
||||||
cimgui.c.ImGuiTableColumnFlags_WidthStretch,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
|
|
||||||
var it = self.vt_events.iterator(.reverse);
|
|
||||||
while (it.next()) |ev| {
|
|
||||||
// Need to push an ID so that our selectable is unique.
|
|
||||||
cimgui.c.igPushID_Ptr(ev);
|
|
||||||
defer cimgui.c.igPopID();
|
|
||||||
|
|
||||||
cimgui.c.igTableNextRow(cimgui.c.ImGuiTableRowFlags_None, 0);
|
|
||||||
_ = cimgui.c.igTableSetColumnIndex(0);
|
|
||||||
cimgui.c.igText("%s", @tagName(ev.kind).ptr);
|
|
||||||
_ = cimgui.c.igTableSetColumnIndex(1);
|
|
||||||
cimgui.c.igText("%s", ev.str.ptr);
|
|
||||||
}
|
|
||||||
} // table
|
|
||||||
}
|
}
|
||||||
|
@ -66,6 +66,9 @@ pub const VTHandler = struct {
|
|||||||
/// of the inspector because this is pointer-stable.
|
/// of the inspector because this is pointer-stable.
|
||||||
surface: *Surface,
|
surface: *Surface,
|
||||||
|
|
||||||
|
/// True if the handler is currently recording.
|
||||||
|
active: bool = true,
|
||||||
|
|
||||||
/// 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,
|
||||||
@ -87,6 +90,9 @@ pub const VTHandler = struct {
|
|||||||
pub fn handleManually(self: *VTHandler, action: terminal.Parser.Action) !bool {
|
pub fn handleManually(self: *VTHandler, action: terminal.Parser.Action) !bool {
|
||||||
const insp = self.surface.inspector orelse return false;
|
const insp = self.surface.inspector orelse return false;
|
||||||
|
|
||||||
|
// If we're pausing, then we ignore all events.
|
||||||
|
if (!self.active) return true;
|
||||||
|
|
||||||
// We ignore certain action types that are too noisy.
|
// We ignore certain action types that are too noisy.
|
||||||
switch (action) {
|
switch (action) {
|
||||||
.dcs_put, .apc_put => return true,
|
.dcs_put, .apc_put => return true,
|
||||||
|
Reference in New Issue
Block a user