Use full command as title in shell integration
* integration/bash (__eat_in_prompt_command): Rename to '__eat_inhibit_preexec'. * integration/bash (__eat_before_exec): Inhibit further '__eat_preexec' calls until next prompt. * integration/bash (__eat_preexec): Use 'history' to get the real command typed by the user.
This commit is contained in:
parent
f4b5fd527e
commit
a21e665120
2 changed files with 12 additions and 7 deletions
5
eat.el
5
eat.el
|
@ -249,8 +249,9 @@ This value is used by terminal programs to identify the terminal."
|
|||
(function :tag "Function"))
|
||||
:group 'eat-term)
|
||||
|
||||
;; Upgrading Eat causes `eat-term-terminfo-directory' to be outdated,
|
||||
;; so update it if not modified by user (or something else).
|
||||
;; Upgrading Eat causes `eat-term-terminfo-directory' and
|
||||
;; `eat-term-shell-integration-directory' to be outdated, so update it
|
||||
;; if not modified by user (or something else).
|
||||
(defvar eat--install-path nil
|
||||
"Path to directory where Eat is installed.")
|
||||
|
||||
|
|
|
@ -25,27 +25,31 @@ __eat_prompt_command () {
|
|||
__eat_preexec () {
|
||||
# "${PWD/$HOME/'~'}" converts "/home/akib/org/" to "~/org/".
|
||||
# The next one is substituted with '$', or '#' if we're "root".
|
||||
# The final one gets the real command typed by the user from the
|
||||
# history.
|
||||
printf '\e]2;%s@%s:%s%s %s\e\\' "$USER" "$HOSTNAME" \
|
||||
"${PWD/$HOME/'~'}" \
|
||||
"$(test $UID -eq 0 && echo '#' || echo '$')" "$BASH_COMMAND"
|
||||
"$(test $UID -eq 0 && echo '#' || echo '$')" \
|
||||
"$(history 1 | sed 's/ *[0-9]* *//')"
|
||||
}
|
||||
|
||||
__eat_in_prompt_command=no
|
||||
__eat_inhibit_preexec=yes
|
||||
|
||||
__eat_before_prompt_command ()
|
||||
{
|
||||
__eat_in_prompt_command=yes
|
||||
__eat_inhibit_preexec=yes
|
||||
}
|
||||
|
||||
__eat_after_prompt_command ()
|
||||
{
|
||||
__eat_in_prompt_command=no
|
||||
__eat_inhibit_preexec=no
|
||||
}
|
||||
|
||||
__eat_before_exec () {
|
||||
if test $__eat_in_prompt_command = no \
|
||||
if test $__eat_inhibit_preexec = no \
|
||||
&& test "$BASH_COMMAND" != __eat_before_prompt_command
|
||||
then
|
||||
__eat_inhibit_preexec=yes
|
||||
__eat_preexec
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue