mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-18 05:20:29 +00:00
inspector: show if we've seen semantic content in screen
This commit is contained in:
@@ -57,7 +57,7 @@ pub const Info = struct {
|
||||
|
||||
if (cimgui.c.ImGui_CollapsingHeader(
|
||||
"Cursor",
|
||||
cimgui.c.ImGuiTreeNodeFlags_None,
|
||||
cimgui.c.ImGuiTreeNodeFlags_DefaultOpen,
|
||||
)) {
|
||||
cursorTable(&screen.cursor);
|
||||
cimgui.c.ImGui_Separator();
|
||||
@@ -69,7 +69,7 @@ pub const Info = struct {
|
||||
|
||||
if (cimgui.c.ImGui_CollapsingHeader(
|
||||
"Keyboard",
|
||||
cimgui.c.ImGuiTreeNodeFlags_None,
|
||||
cimgui.c.ImGuiTreeNodeFlags_DefaultOpen,
|
||||
)) keyboardTable(
|
||||
screen,
|
||||
data.modify_other_keys_2,
|
||||
@@ -77,13 +77,13 @@ pub const Info = struct {
|
||||
|
||||
if (cimgui.c.ImGui_CollapsingHeader(
|
||||
"Kitty Graphics",
|
||||
cimgui.c.ImGuiTreeNodeFlags_None,
|
||||
cimgui.c.ImGuiTreeNodeFlags_DefaultOpen,
|
||||
)) kittyGraphicsTable(&screen.kitty_images);
|
||||
|
||||
if (cimgui.c.ImGui_CollapsingHeader(
|
||||
"Internal Terminal State",
|
||||
cimgui.c.ImGuiTreeNodeFlags_None,
|
||||
)) internalStateTable(&screen.pages);
|
||||
"Other Screen State",
|
||||
cimgui.c.ImGuiTreeNodeFlags_DefaultOpen,
|
||||
)) internalStateTable(screen);
|
||||
}
|
||||
|
||||
// Cell window
|
||||
@@ -327,8 +327,10 @@ pub fn kittyGraphicsTable(
|
||||
|
||||
/// Render internal terminal state table.
|
||||
pub fn internalStateTable(
|
||||
pages: *const terminal.PageList,
|
||||
screen: *const terminal.Screen,
|
||||
) void {
|
||||
const pages = &screen.pages;
|
||||
|
||||
if (!cimgui.c.ImGui_BeginTable(
|
||||
"##terminal_state",
|
||||
2,
|
||||
@@ -347,9 +349,21 @@ pub fn internalStateTable(
|
||||
cimgui.c.ImGui_Text("Memory Limit");
|
||||
_ = cimgui.c.ImGui_TableSetColumnIndex(1);
|
||||
cimgui.c.ImGui_Text("%d bytes (%d KiB)", pages.maxSize(), units.toKibiBytes(pages.maxSize()));
|
||||
|
||||
cimgui.c.ImGui_TableNextRow();
|
||||
_ = cimgui.c.ImGui_TableSetColumnIndex(0);
|
||||
cimgui.c.ImGui_Text("Viewport Location");
|
||||
_ = cimgui.c.ImGui_TableSetColumnIndex(1);
|
||||
cimgui.c.ImGui_Text("%s", @tagName(pages.viewport).ptr);
|
||||
|
||||
{
|
||||
cimgui.c.ImGui_TableNextRow();
|
||||
_ = cimgui.c.ImGui_TableSetColumnIndex(0);
|
||||
cimgui.c.ImGui_Text("Semantic Content");
|
||||
cimgui.c.ImGui_SameLine();
|
||||
widgets.helpMarker("Whether semantic prompt markers (OSC 133) have been seen.");
|
||||
_ = cimgui.c.ImGui_TableSetColumnIndex(1);
|
||||
var value: bool = screen.flags.semantic_content;
|
||||
_ = cimgui.c.ImGui_Checkbox("##semantic_content", &value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ pub const Inspector = struct {
|
||||
terminal_info: widgets.terminal.Info,
|
||||
vt_stream: widgets.termio.Stream,
|
||||
renderer_info: widgets.renderer.Info,
|
||||
show_demo_window: bool,
|
||||
|
||||
pub fn init(alloc: Allocator) !Inspector {
|
||||
return .{
|
||||
@@ -33,6 +34,7 @@ pub const Inspector = struct {
|
||||
.terminal_info = .empty,
|
||||
.vt_stream = try .init(alloc),
|
||||
.renderer_info = .empty,
|
||||
.show_demo_window = true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -52,13 +54,6 @@ pub const Inspector = struct {
|
||||
const dockspace_id = cimgui.c.ImGui_GetID("Main Dockspace");
|
||||
const first_render = createDockSpace(dockspace_id);
|
||||
|
||||
// In debug we show the ImGui demo window so we can easily view
|
||||
// available widgets and such.
|
||||
if (comptime builtin.mode == .Debug) {
|
||||
var show: bool = true; // Always show it
|
||||
cimgui.c.ImGui_ShowDemoWindow(&show);
|
||||
}
|
||||
|
||||
// Draw everything that requires the terminal state mutex.
|
||||
{
|
||||
surface.renderer_state.mutex.lock();
|
||||
@@ -136,6 +131,14 @@ pub const Inspector = struct {
|
||||
}
|
||||
}
|
||||
|
||||
// In debug we show the ImGui demo window so we can easily view
|
||||
// available widgets and such.
|
||||
if (comptime builtin.mode == .Debug) {
|
||||
if (self.show_demo_window) {
|
||||
cimgui.c.ImGui_ShowDemoWindow(&self.show_demo_window);
|
||||
}
|
||||
}
|
||||
|
||||
if (first_render) {
|
||||
// On first render, setup our initial focus state. We only
|
||||
// do this on first render so that we can let the user change
|
||||
@@ -171,12 +174,12 @@ pub const Inspector = struct {
|
||||
// this is the point we'd pre-split and so on for the initial
|
||||
// layout.
|
||||
const dock_id_main: cimgui.c.ImGuiID = dockspace_id;
|
||||
cimgui.ImGui_DockBuilderDockWindow(window_imgui_demo, dock_id_main);
|
||||
cimgui.ImGui_DockBuilderDockWindow(window_terminal, dock_id_main);
|
||||
cimgui.ImGui_DockBuilderDockWindow(window_surface, dock_id_main);
|
||||
cimgui.ImGui_DockBuilderDockWindow(window_keyboard, dock_id_main);
|
||||
cimgui.ImGui_DockBuilderDockWindow(window_termio, dock_id_main);
|
||||
cimgui.ImGui_DockBuilderDockWindow(window_renderer, dock_id_main);
|
||||
cimgui.ImGui_DockBuilderDockWindow(window_imgui_demo, dock_id_main);
|
||||
cimgui.ImGui_DockBuilderFinish(dockspace_id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user