Commit Graph

14174 Commits

Author SHA1 Message Date
mitchellh
ef2c90cd2b deps: Update iTerm2 color schemes 2026-02-01 00:20:14 +00:00
Mitchell Hashimoto
8d1d17e00f Inspector Revamp (#10509)
I'm going to keep this PR description brief, because there's a lot more
work I want to do here. And when I do it I'll talk more about it. But
this basically rewrites the inspector. It has almost all the same
functionality (missing one from the old inspector -- cell picking). But
it is organized in a much cleaner way and the memory management is also
a lot more clean. We also expose a LOT more details about things like
PageList and screens.

There are plenty of bugs and polish issues here. But going to merge this
because the inspector isn't a hot path item for people and a review of
this is not really possible. Plus it paves the way to more debug
overlays.
2026-01-31 10:21:51 -08:00
Mitchell Hashimoto
fb8cb162ce macos: Ghostty.Inspector 2026-01-31 09:22:26 -08:00
Mitchell Hashimoto
513b55e0a4 inspector: always render the surface when the inspector is opened 2026-01-31 09:14:29 -08:00
Mitchell Hashimoto
dc2cca6490 inspector: renderer panel 2026-01-31 09:06:07 -08:00
Mitchell Hashimoto
400d17aa0d inspector: remove cell picker 2026-01-31 08:47:15 -08:00
Mitchell Hashimoto
3793188e38 inspector: termio revamp 2026-01-31 08:47:15 -08:00
Mitchell Hashimoto
75eac6e3ea terminal: stream handleManually => vtRaw 2026-01-31 08:47:15 -08:00
Mitchell Hashimoto
4fa2dab20d inspector: clean up termio layouts 2026-01-31 08:47:15 -08:00
Mitchell Hashimoto
32ac82c66f inspector: no longer holds surface pointer 2026-01-31 08:47:15 -08:00
Mitchell Hashimoto
3e825dd608 inspector: clean up Inspector 2026-01-31 08:47:15 -08:00
Mitchell Hashimoto
e9439533a7 inspector: prettify keyboard stream 2026-01-31 08:47:15 -08:00
Mitchell Hashimoto
caf301d548 inspector: move termio to dedicated widget 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
b2c8cdbc90 inspector: key events 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
9056fa7fd1 inspector: cell inspector 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
19d2fca9c4 inspector: grid 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
76fe2e9fbb inspector: hyperlinks 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
3246d1f7ef inspector: page managed styles 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
3ac4f70e48 inspector: clean up page 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
51ce210833 terminal: add helpers to BitmapAllocator for sizing 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
9b75f4a799 inspector: page improvements 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
c8e048f309 inspector: pagelist 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
7f008d126f inspector: surface info is back 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
53b2a777e7 inspector: screen info has its own dockspace 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
fdbe4343c2 remove some unused files 2026-01-31 08:47:14 -08:00
Mitchell Hashimoto
b37ac8b287 inspector: screen cursor info 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
5c867bf1d7 inspector: move style to widgets dir 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
82dd9021bf inspector: starting screen 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
28086a7adc inspector: terminal migrate content 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
7cfac87fc4 inspector: trying new stuff 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
38aae2325d inspector: trying new logic layout 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
a25e91bb25 pkg/dcimgui: expose more private dockbuilder stuff 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
7073fb88f4 inspector: remove cursor helper, move it to screen, style helper 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
bdd0295e0e inspector: add style file for style widgets 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
1fa74b19e8 inspector: grid section lets you pick a cell 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
f23e67388d inspector: add grid section to screen 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
4992212ecd inspector: add more cursor state 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
e5a03a103c inspector: show warning if inactive screen being viewed 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
0b3f4ae340 inspector: move screens to terminal section 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
4c5af7073e inspector: move screen window to dedicated file 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
4c2ea6a9d8 inspector: fix up detachable headers to dock 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
1d7def0d2e inspector: move modes out to separate header 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
86af16b081 inspector: move surface window out to its own file 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
ff14938389 inspector: detachable collapsing headers 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
d58703a245 update AGENTS.md 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
061730ef97 inspector: terminal mouse section 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
03f012f567 inspector: terminal colors 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
41b5dc4928 inspector: terminal tab 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
377c6d7700 inspector: add AGENTS.md 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
d8b1b09eb7 Renderer: Debug Overlay Framework (#10503)
This adds a cross-platform ability to draw an overlay of debug
information directly on top of our terminal.

The debug overlay is drawn on the CPU using z2d and then rendered as an
image on the GPU (using the same subsystem and shaders as things like
the Kitty Graphics Protocol). This lets us iterate more quickly on
overlays since it's all simple imperative 2D drawing operations, and
also lets it be cross-platform immediately.

The goal of this PR is to **introduce the framework.** To enable the
overlays, you have to modify code and recompile it, but of course in the
future this will be runtime toggle-able via the inspector. Additionally,
the dummy overlay in this PR (OSC8 highlighting) isn't particularly
useful and has limitations; it's only meant to be a demo. More realistic
overlays will come later.

## Demo

Here is a demo of an overlay highlighting OSC8 hyperlinks:

<img width="1746" height="1648" alt="CleanShot_2026-01-30_at_15 04 582x"
src="https://github.com/user-attachments/assets/4c490d11-5baa-4ef6-b97b-1cfd321235d8"
/>

## Performance

```
Empty but overlay active:
generic_renderer: [rebuildOverlay time] start_micro=1769835575905814 duration=12ns
generic_renderer: [updateFrame time] start_micro=1769835575905766 duration=199ns

Hyperlink on every line:
generic_renderer: [rebuildOverlay time] start_micro=1769835573560797 duration=452ns
generic_renderer: [updateFrame time] start_micro=1769835573560682 duration=891ns
```

Pretty great! 🎉

With the overlay active but nothing to draw, the overlay adds ~6%
overhead. With the overlay active and hyperlinks on every line, the
overlay adds ~50% overhead. These are big percentages, but the absolute
numbers are miniscule. And, for a high value debug feature that is only
on some of the time, it's totally acceptable.

Also, as a reminder, for 120fps we have _8.3 million nanoseconds_ per
frame (including the time to draw, of course). If we're spending
sub-1000ns we're in the realm of 1M FPS. So, it's fine. lol.

(Edit: I previously had debug timings which are significantly worse but
have a lot more safety checks.)

## Other Notes

* **Damage/dirty tracking.** I don't do any for the overlay, and we just
rebuild it on every frame. I'm not convinced the complexity is worth it
for a debug overlay and the performance numbers at this point do not
necessitate it in any way.

* **Update vs draw times.** We call `draw` _far_ more often than
`update` so putting the overlay rebuild into `update` made way more
sense. I did measure both.
2026-01-31 08:46:52 -08:00