diff --git a/eat.el b/eat.el index 7b1f4cd..1f937ea 100644 --- a/eat.el +++ b/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.") diff --git a/integration/bash b/integration/bash index dcc639a..1c2a5c3 100644 --- a/integration/bash +++ b/integration/bash @@ -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 }