* eat.el (eat-mode): Escape '%' character in title

This commit is contained in:
Illia Ostapyshyn 2023-09-14 20:39:10 +06:00 committed by Akib Azmain Turja
parent ccfccf016b
commit 7bff1c4974
No known key found for this signature in database
GPG key ID: 5535FCF54D88616B
2 changed files with 6 additions and 5 deletions
eat.el
integration

9
eat.el
View file

@ -6253,10 +6253,11 @@ mouse-3: Switch to char mode"
'(" " '(" "
(:propertize (:propertize
(:eval (:eval
(when (and eat--terminal (when-let* (((eat--terminal))
(not (string-empty-p (eat-term-title (title (eat-term-title eat--terminal))
eat--terminal)))) ((not (string-empty-p title))))
(format "(%s)" (eat-term-title eat--terminal)))) (format "(%s)" (string-replace "%" "%%"
title))))
help-echo "Title")))))) help-echo "Title"))))))
(eat-emacs-mode) (eat-emacs-mode)
;; Make sure glyphless character don't display a huge box glyph, ;; Make sure glyphless character don't display a huge box glyph,

View file

@ -30,7 +30,7 @@ __eat_precmd () {
"$(printf "%s" "$PWD" | base64)" "$(printf "%s" "$PWD" | base64)"
# Update title. # Update title.
# "${PWD/$HOME/'~'}" converts "/home/akib/org/" to "~/org/". # "${PWD/$HOME/'~'}" converts "/home/akib/org/" to "~/org/".
# The next one is substituted with '$', or '#' if we're "root". # The next one is substituted with '%', or '#' if we're "root".
printf '\e]2;%s@%s:%s%s\e\\' "$USER" "$HOST" "${PWD/$HOME/~}" \ printf '\e]2;%s@%s:%s%s\e\\' "$USER" "$HOST" "${PWD/$HOME/~}" \
"$(test $UID -eq 0 && echo '#' || echo '%')" "$(test $UID -eq 0 && echo '#' || echo '%')"
} }