Fix ghostel-debug-info report truncation and dead key-encoding probe#501
Merged
Conversation
Since the renderer became buffer-affine (679b113), ghostel--new erases the current buffer on init. ghostel-debug-info created its key-encoding probe terminal with *ghostel-debug* current, silently wiping every report section inserted before the probe. Create the probe and run all encodes in a temp buffer instead. The probe also captured encoder bytes by overriding the elisp ghostel--write-pty, which the native PTY path (40f1269) no longer calls, so every encoder-handled chord reported "(no output)". Make ghostel--encode-key return the encoded bytes as a unibyte string (nil when the encoder produced nothing) and read them from the return value; the live send path only tests truthiness and is unchanged. The same change lets ghostel-debug-keypress record encoder bytes again via :filter-return advice.
dakra
force-pushed
the
fix-debug-info-probe
branch
from
July 3, 2026 16:22
a8fa43a to
f23b033
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.
Problem
M-x ghostel-debug-infoproduced a nearly empty report: only a headerless tail of the key-encoding table plus the non-default-settings section survived, and the encoder chords all showed(no output).Two regressions from the 0.40 renderer/PTY rework:
ghostel--newerases the current buffer on init. The key-encoding probe was created with*ghostel-debug*current, silently wiping every section inserted before it (System, Ghostel, Frame, Environment, Buffer, Process, …). No error was signaled.ghostel--write-pty, but the native PTY path (40f1269) writes the PTY directly from Zig and never calls it — and silently drops bytes when no process is live. Only the elisp raw-fallback chords (M-f/M-b/M-.) still showed bytes.ghostel-debug-keypresshad the same blindness via itsghostel--write-ptyadvice.Fix
with-temp-buffer, so the buffer-affine init can't touch*ghostel-debug*.ghostel--encode-keynow returns the encoded bytes as a unibyte string (nil when the encoder produced nothing) instead oft. The live send path only tests truthiness and is unchanged; no extra heap on the Zig side (the stack buffer moved to the caller). The probe reads bytes from the return value, andghostel-debug-keypressrecords them via:filter-returnadvice.Verification
make -j8 allpasses; two new native ERT tests (report survives the probe;ghostel--encode-keyreturns0x7ffor Backspace).ghostel-debug-keypresson Backspace recordsencode-key: hex 7f.