plugin/xterm: don't rely on `$1`
_bash-preexec_ passes the "current" command line as `$1`, but this is unreliable and we explicitly discourage it's use. Use `$BASH_COMMAND` instead.pull/1979/head
parent
9ce199c251
commit
bdfb987f0c
|
|
@ -30,7 +30,11 @@ precmd_xterm_title() {
|
|||
}
|
||||
|
||||
preexec_xterm_title() {
|
||||
set_xterm_title "$(_short-command "${1:-}") {$(_short-dirname)} (${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}})"
|
||||
local command_line="${BASH_COMMAND:-${1:-}}"
|
||||
local directory_name short_command
|
||||
directory_name="$(_short-dirname)"
|
||||
short_command="$(_short-command "${command_line}")"
|
||||
set_xterm_title "${short_command} {${directory_name}} (${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}})"
|
||||
}
|
||||
|
||||
case "${TERM:-dumb}" in
|
||||
|
|
|
|||
Loading…
Reference in New Issue