Commit 06431d0e authored by Christoph Anton Mitterer's avatar Christoph Anton Mitterer
Browse files

use bash’s PROMPT_COMMAND as array

Previously, PROMPT_COMMAND was simply overwritten possibly breaking anything
already added to it.

Bash may use PROMPT_COMMAND as an array.
By adding the VTE command via an array compound assignment with the += operator,
a PROMPT_COMMAND that has already been set as a (plain) parameter would be
converted to an indexed array and appended.

This would not work with an associative array (but fail gracefully), but at
least in current versions of bash (5.1.8 as of now), these cannot be used
properly for PROMPT_COMMAND anyway.
parent c17e6d12
......@@ -36,7 +36,7 @@ __vte_prompt_command() {
case "$TERM" in
[ -n "${BASH_VERSION:-}" ] && PROMPT_COMMAND="__vte_prompt_command"
[ -n "${BASH_VERSION:-}" ] && PROMPT_COMMAND+=('__vte_prompt_command')
[ -n "${ZSH_VERSION:-}" ] && precmd_functions+=(__vte_osc7)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment