dot/shell-rc: Write the various control sequences to the terminal explicitly.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 25 Apr 2020 01:21:03 +0000 (02:21 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 25 Apr 2020 01:21:03 +0000 (02:21 +0100)
dot/shell-rc

index 0b6e94b..55a245f 100644 (file)
@@ -146,11 +146,11 @@ __mdw_set_prompt () {
   esac
 }
 
-__mdw_xterm_precmd () { printf "\e]2;%s@%s:%s – %s\e\\" "$USER" "$__mdw_host" "$PWD" "$__mdw_shell"; }
-__mdw_xterm_preexec () { printf "\e]2;%s@%s:%s – %s\e\\" "$USER" "$__mdw_host" "$PWD" "$1"; }
+__mdw_xterm_precmd () { printf >/dev/tty "\e]2;%s@%s:%s – %s\e\\" "$USER" "$__mdw_host" "$PWD" "$__mdw_shell"; }
+__mdw_xterm_preexec () { printf >/dev/tty "\e]2;%s@%s:%s – %s\e\\" "$USER" "$__mdw_host" "$PWD" "$1"; }
 
-__mdw_screen_precmd () { printf "\ek%s\e\\" "$__mdw_shell"; }
-__mdw_screen_preexec () { printf "\ek%s\e\\" "$1"; }
+__mdw_screen_precmd () { printf >/dev/tty "\ek%s\e\\" "$__mdw_shell"; }
+__mdw_screen_preexec () { printf >/dev/tty "\ek%s\e\\" "$1"; }
 
 if [ -t 0 ]; then
   case ${STY+t},${__mdw_precmd_hook+t},${__mdw_preexec_hook+t},${TERM} in