Use _get_multi for render state queries and add VT log callback#95
Merged
Use _get_multi for render state queries and add VT log callback#95
Conversation
Batch the default-color and cursor-style render state queries into ghostty_render_state_get_multi calls (2 keys each) to take advantage of the new batched query API in libghostty. Add a log callback that routes libghostty internal log messages through the *ghostel-debug* buffer when ghostel-debug-start is active. The callback is installed via ghostty_sys_set and stashes the Emacs env during fnWriteInput/fnRedraw so it can safely call into Elisp. Also fix `make build` to pass -Doptimize=ReleaseFast -Dcpu=baseline so that plain `make all` produces a release binary instead of an unoptimized debug build.
There was a problem hiding this comment.
Pull request overview
This PR batches select libghostty render-state queries via the new ghostty_render_state_get_multi API, adds a native-module-installed VT log callback that forwards libghostty internal logs into the *ghostel-debug* buffer, and updates build invocations to consistently produce a release binary.
Changes:
- Batch render-state queries for default FG/BG colors and cursor visibility/style using
ghostty_render_state_get_multi. - Add Emacs-native-module functions to enable/disable a libghostty log callback and route messages to
ghostel--debug-log-vt. - Update
make build(and align Elisp compilation invocation formatting) to pass-Doptimize=ReleaseFast -Dcpu=baseline.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/render.zig | Switches default color and cursor style/visibility queries to batched render-state lookups. |
| src/module.zig | Adds VT log callback plumbing and exposes ghostel--enable-vt-log / ghostel--disable-vt-log. |
| src/emacs.zig | Adds cached symbol for ghostel--debug-log-vt used by the native callback. |
| Makefile | Ensures make build produces a release-optimized baseline CPU build. |
| ghostel.el | Keeps the Zig build invocation consistent (minor formatting). |
| ghostel-debug.el | Starts/stops VT log routing when debug logging is enabled/disabled and adds ghostel--debug-log-vt. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fb7f331 to
a3d043a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ghostty_render_state_get_multicalls (2 keys each), taking advantage of the new batched query API in libghostty*ghostel-debug*buffer whenghostel-debug-startis active, viaghostty_sys_set(GHOSTTY_SYS_OPT_LOG, callback)make buildto pass-Doptimize=ReleaseFast -Dcpu=baselineso thatmake allproduces a release binaryNotes
Cell-level and row-level
_get_multibatching was explored but reverted:FG_COLOR/BG_COLORreturnNO_VALUEfor default-colored cells, stopping the batch beforeSTYLEis fetchedROW_DATA_CELLSpopulates a pre-allocated handle rather than writing a new one, requiring&term.row_cellsinstead of a local variableTest plan
make allpasses (105 native tests, 30 evil tests, lint)ghostel-debug-start, verify VT log messages appear in*ghostel-debug*findor similar rapid-output commands