Shell integration: bash: Dont fail if an existing PROMPT_COMMAND ends with a semi-colon

Fixes #4645
This commit is contained in:
Kovid Goyal 2022-02-06 19:02:39 +05:30
parent dddff91fad
commit f9d9fe6db4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 0 deletions

View File

@ -105,6 +105,8 @@ Detailed list of changes
- Linux: Fix rendering of emoji when using scalable fonts such as Segoe UI Emoji
- Shell integration: bash: Dont fail if an existing PROMPT_COMMAND ends with a semi-colon (:iss:`4645`)
0.24.2 [2022-02-03]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -141,6 +141,8 @@ _ksi_main() {
elif [[ $(builtin declare -p PROMPT_COMMAND 2> /dev/null) =~ 'declare -a PROMPT_COMMAND' ]]; then
PROMPT_COMMAND+=("_ksi_prompt_command")
else
PROMPT_COMMAND="${PROMPT_COMMAND%% }"
PROMPT_COMMAND="${PROMPT_COMMAND%%;}"
PROMPT_COMMAND+="; _ksi_prompt_command"
fi
}