Repository navigation
Answer XTVERSION as ghostty when ghostel-term is xterm-ghostty - #801
Merged
Merged
Conversation
libghostty-vt answered `CSI > q' with its default name `libghostty'. Programs that pick features from the XTVERSION name did not treat ghostel as Ghostty, whatever TERM and TERM_PROGRAM said. Claude Code draws kitty graphics images only for an accepted name, so images needed CLAUDE_CODE_FORCE_TERMINAL_IMAGES=1. Answer `ghostty <version>' when `ghostel-term' is "xterm-ghostty", the condition under which TERM_PROGRAM=ghostty is exported, and keep `libghostty' otherwise. The reply does not depend on kitty graphics being enabled: a terminal with image storage disabled still leaves the graphics query unanswered. `ghostel--init-buffer' passes the string to `ghostel--new' as a new optional argument, since the query can be answered on the PTY reader thread, where no Emacs state is reachable. `ghostel--ghostty-version' holds the version for both the reply and TERM_PROGRAM_VERSION, and moves it from 1.3.2 to 1.4.0.
This branch was previously deployed
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.
libghostty-vt answers the XTVERSION query (
CSI > q) with its default namelibghostty. Programs that pick features from that name do not treat ghostel as Ghostty, whateverTERMandTERM_PROGRAMsay. Claude Code draws kitty graphics images only for an accepted name (ghosttyorkitty), so images in ghostel neededCLAUDE_CODE_FORCE_TERMINAL_IMAGES=1.Ghostel now answers
ghostty 1.4.0whenghostel-termisxterm-ghostty, andlibghosttyotherwise.Behaviour
TERM_PROGRAM=ghosttyis exported. Theghostel-termdocstring already promises that with another value nothing claims to be Ghostty.ghostel-kitty-graphics-storage-limit0) still leaves the graphics query unanswered, so Claude Code settles on no images there.ghostel-termalone. The environment claim on a remote also depends oninfocmp xterm-ghostty; the in-band reply cannot.ghostel--ghostty-versionholds the version for both the reply andTERM_PROGRAM_VERSION, which moves from 1.3.2 to 1.4.0.Implementation
ghostel--init-bufferpasses the string toghostel--newas a sixth optional argument, and the terminal keeps a copy for libghostty-vt'sxtversioneffect. The query can be answered on the PTY reader thread, where no Emacs state is reachable, so the value has to be fixed at creation.Verification
ghostel-test-xtversion-follows-ghostel-termchecks both replies.printf '\033[>q'reads backESC P > | ghostty 1.4.0 ESC \by default andlibghosttywithghostel-termset toxterm-256color.--debug-fileand no force variable logsXTVERSION: terminal identified as "ghostty 1.4.0", thenkittyGraphics=yes (probe: graphics reply OK, terminal ghostty 1.4.0)in a GUI frame andkittyGraphics=no (probe: no reply to the graphics query)in a text frame.Not checked: Claude Code inside tmux, which decides from the name tmux recorded for the outer terminal.