Repository navigation
Clear the terminal title on an empty OSC 0/2 - #623
Merged
Merged
Conversation
An empty OSC 0/2 title was silently dropped at the native title callback: libghostty stores a cleared title as no title, getTitle returns null for it, and the callback only forwarded non-null titles. The stale title stayed in the mode line and in a title-derived buffer name until the next title report. Forward the cleared title as "" and treat it in ghostel--set-title as "as if no title was ever set", matching Ghostty and iTerm2: normalize to a nil ghostel--title (the mode line falls back to the plain buffer name) and revert a title-derived buffer name to ghostel--buffer-identity. The revert only applies to names title tracking has claimed and still goes through the manual-rename guard. ghostel--init-buffer now backfills a nil ghostel--buffer-identity with the creation name so buffers created outside the ghostel command (ghostel-exec, eshell visual commands) have a revert target. With ghostel--title now nil or non-empty, drop the empty-string handling in ghostel--buffer-identification and ghostel-buffer-name-by-title. Fixes #619
Contributor
|
Thanks for picking this up so quickly! I built the module from this branch and ran it on macOS (aarch64, Emacs 30). The new regression test passes here, and a set/clear round-trip now clears The handler.zig change matches what I found when filing #619. The identity backfill for LGTM! |
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.
An empty OSC 0/2 title (
printf '\e]2;\a', the standard way to reset a title) was silently dropped at the native title callback: libghostty stores a cleared title as no title,getTitlereturns null for it, and the callback only forwarded non-null titles. The stale title stayed in the mode line and in a title-derived buffer name until the next title report.Changes
src/handler.zig—titleChangedCallbackforwards a cleared title as""instead of dropping it. libghostty delivers the clear correctly end to end (empty payload still parses aschange_window_title,title_changedfires unconditionally); this guard was the only drop point.lisp/ghostel.el—ghostel--set-titletreats an empty title as "as if no title was ever set", matching Ghostty and iTerm2:ghostel--titlenormalizes to nil (invariant is now nil-or-non-empty, so the mode line falls back to the plain buffer name), and a title-derived buffer name reverts toghostel--buffer-identity. The revert only applies to names title tracking has claimed and still goes through the manual-rename guard.ghostel--init-bufferbackfills a nilghostel--buffer-identitywith the creation name so buffers created outside theghostelcommand (ghostel-exec, eshell visual commands) have a revert target.ghostel--buffer-identificationandghostel-buffer-name-by-titleis removed; theghostel-buffer-name-functioncontract is now "nil or non-empty string" (custom name functions see nil on a clear, never"").Tests
ghostel--titleand the reverted buffer name on both backends.--norc, shell integration off): OSC 0/2 set/clear round-trips updateghostel--title, the mode line (no empty-parens leftovers), and by-title renames/reverts, with manual renames respected.Fixes #619