mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-24 23:00:09 +00:00
fix(lib): fix automatic title abort inside Emacs (#10124)
Closes #10124 Co-authored-by: Paul Schorfheide <pschorf2@gmail.com> Co-authored-by: Alastair Rankine <alastair@girtby.net>
This commit is contained in:
parent
de76f7cb49
commit
54e3e8ef54
1 changed files with 10 additions and 10 deletions
|
@ -10,7 +10,8 @@ function title {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
setopt prompt_subst
|
setopt prompt_subst
|
||||||
|
|
||||||
[[ "$INSIDE_EMACS" == *term* ]] && return
|
# Don't set the title if inside emacs, unless using vterm
|
||||||
|
[[ -n "$INSIDE_EMACS" && "$INSIDE_EMACS" != vterm ]] && return
|
||||||
|
|
||||||
# if $2 is unset use $1 as default
|
# if $2 is unset use $1 as default
|
||||||
# if it is set and empty, leave it as is
|
# if it is set and empty, leave it as is
|
||||||
|
@ -29,12 +30,9 @@ function title {
|
||||||
print -Pn "\e]2;${2:q}\a" # set window name
|
print -Pn "\e]2;${2:q}\a" # set window name
|
||||||
print -Pn "\e]1;${1:q}\a" # set tab name
|
print -Pn "\e]1;${1:q}\a" # set tab name
|
||||||
else
|
else
|
||||||
# Try to use terminfo to set the title
|
# Try to use terminfo to set the title if the feature is available
|
||||||
# If the feature is available set title
|
if (( ${+terminfo[fsl]} && ${+terminfo[tsl]} )); then
|
||||||
if [[ -n "$terminfo[fsl]" ]] && [[ -n "$terminfo[tsl]" ]]; then
|
print -Pn "${terminfo[tsl]}$1${terminfo[fsl]}"
|
||||||
echoti tsl
|
|
||||||
print -Pn "$1"
|
|
||||||
echoti fsl
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -105,10 +103,12 @@ function omz_termsupport_preexec {
|
||||||
title '$CMD' '%100>...>$LINE%<<'
|
title '$CMD' '%100>...>$LINE%<<'
|
||||||
}
|
}
|
||||||
|
|
||||||
autoload -U add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
|
if [[ -z "$INSIDE_EMACS" || "$INSIDE_EMACS" = vterm ]]; then
|
||||||
add-zsh-hook precmd omz_termsupport_precmd
|
add-zsh-hook precmd omz_termsupport_precmd
|
||||||
add-zsh-hook preexec omz_termsupport_preexec
|
add-zsh-hook preexec omz_termsupport_preexec
|
||||||
|
fi
|
||||||
|
|
||||||
# Keep Apple Terminal.app's current working directory updated
|
# Keep Apple Terminal.app's current working directory updated
|
||||||
# Based on this answer: https://superuser.com/a/315029
|
# Based on this answer: https://superuser.com/a/315029
|
||||||
|
|
Loading…
Reference in a new issue