rcaloras / bash-preexec

⚡ preexec and precmd functions for Bash just like Zsh.
MIT License
862 stars 94 forks source link

Handle another edge case in $PROMPT_COMMAND. #154

Open JeffFaer opened 6 months ago

JeffFaer commented 6 months ago

In particular: bash-preexec installs itself by appending bp_install_string to $PROMPT_COMMAND. That means that there's a pretty good change that __bp_install_string will be the last thing in $PROMPT_COMMAND when bp_install is invoked.

If that happens, the $existing_prompt_command logic in __bp_install will result in the pre-existing prompt command followed by : and no trailing newline. That situation is not cleaned up by the two existing special cases.

Fix https://github.com/rcaloras/bash-preexec/issues/153

akinomyoga commented 6 months ago

This is a part of #143. In particular, https://github.com/rcaloras/bash-preexec/pull/143/commits/fe5aedb3368d78fc47e017ceffca1d8265cdef0d is the commit for colon reduction with other refactoring and also contains the unit tests for that.