From 076f742dd4da1b1a90c98d237977c356a2c7f079 Mon Sep 17 00:00:00 2001 From: Jason Rayne Date: Wed, 25 Jun 2025 17:50:15 -0700 Subject: [PATCH] fix: replace non-existent GHOSTTY_VERSION with TERM_PROGRAM_VERSION in shell integration GHOSTTY_VERSION was mistakenly referenced but is never set. Use TERM_PROGRAM_VERSION which is actually provided by Exec.zig from build_config.version_string. --- src/shell-integration/bash/ghostty.bash | 2 +- .../elvish/lib/ghostty-integration.elv | 10 +++++----- .../fish/vendor_conf.d/ghostty-shell-integration.fish | 4 ++-- src/shell-integration/zsh/ghostty-integration | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/shell-integration/bash/ghostty.bash b/src/shell-integration/bash/ghostty.bash index f07df125e..b51dae9c7 100644 --- a/src/shell-integration/bash/ghostty.bash +++ b/src/shell-integration/bash/ghostty.bash @@ -111,7 +111,7 @@ if [[ "$GHOSTTY_SHELL_FEATURES" =~ ssh-(env|terminfo) ]]; then local vars=( COLORTERM=truecolor TERM_PROGRAM=ghostty - ${GHOSTTY_VERSION:+TERM_PROGRAM_VERSION=$GHOSTTY_VERSION} + ${TERM_PROGRAM_VERSION:+TERM_PROGRAM_VERSION=$TERM_PROGRAM_VERSION} ) for v in "${vars[@]}"; do builtin export "${v?}" diff --git a/src/shell-integration/elvish/lib/ghostty-integration.elv b/src/shell-integration/elvish/lib/ghostty-integration.elv index 7048d56b3..084861434 100644 --- a/src/shell-integration/elvish/lib/ghostty-integration.elv +++ b/src/shell-integration/elvish/lib/ghostty-integration.elv @@ -119,10 +119,10 @@ COLORTERM=truecolor TERM_PROGRAM=ghostty ] - if (not-eq $E:GHOSTTY_VERSION '') { - set vars = [$@vars TERM_PROGRAM_VERSION=$E:GHOSTTY_VERSION] + if (not-eq $E:TERM_PROGRAM_VERSION '') { + set vars = [$@vars TERM_PROGRAM_VERSION=$E:TERM_PROGRAM_VERSION] } - + for v $vars { set-env (str:split = $v | take 1) (str:split = $v | drop 1 | str:join =) var varname = (str:split = $v | take 1) @@ -147,7 +147,7 @@ } catch { echo "Warning: xterm-ghostty terminfo not found locally." >&2 } - + if (not-eq $tinfo '') { echo "Setting up Ghostty terminfo on remote host..." >&2 var cpath = '/tmp/ghostty-ssh-'$E:USER'-'(randint 0 32767)'-'(date +%s) @@ -156,7 +156,7 @@ command -v tic >/dev/null 2>&1 || { echo NO_TIC; exit 1; } mkdir -p ~/.terminfo 2>/dev/null && tic -x - 2>/dev/null && echo OK || echo FAIL ') - + if (eq $result OK) { echo "Terminfo setup complete." >&2 if (not-eq $target '') { $_CACHE add $target } diff --git a/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish b/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish index 083087bd5..4c780b5a7 100644 --- a/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish +++ b/src/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish @@ -105,8 +105,8 @@ function __ghostty_setup --on-event fish_prompt -d "Setup ghostty integration" COLORTERM=truecolor \ TERM_PROGRAM=ghostty - if test -n "$GHOSTTY_VERSION" - set -a vars "TERM_PROGRAM_VERSION=$GHOSTTY_VERSION" + if test -n "$TERM_PROGRAM_VERSION" + set -a vars "TERM_PROGRAM_VERSION=$TERM_PROGRAM_VERSION" end for v in $vars diff --git a/src/shell-integration/zsh/ghostty-integration b/src/shell-integration/zsh/ghostty-integration index 4d4461775..48f8cc934 100644 --- a/src/shell-integration/zsh/ghostty-integration +++ b/src/shell-integration/zsh/ghostty-integration @@ -264,7 +264,7 @@ _ghostty_deferred_init() { vars=( COLORTERM=truecolor TERM_PROGRAM=ghostty - ${GHOSTTY_VERSION:+TERM_PROGRAM_VERSION=$GHOSTTY_VERSION} + ${TERM_PROGRAM_VERSION:+TERM_PROGRAM_VERSION=$TERM_PROGRAM_VERSION} ) for v in "${vars[@]}"; do export "${v?}" @@ -277,7 +277,7 @@ _ghostty_deferred_init() { # Get target (only when needed for terminfo) local target target=$(command ssh -G "$@" 2>/dev/null | awk '/^(user|hostname) /{print $2}' | paste -sd'@') - + if [[ -n "$target" ]] && "$_CACHE" chk "$target"; then env+=(TERM=xterm-ghostty) elif command -v infocmp >/dev/null 2>&1; then