Unbreak rendering & wrapping of commands typed at an interactive prompt

... by wrapping the terminal escape sequences in '\[' and '\]':
https://www.gnu.org/software/bash/manual/html_node/Controlling-the-Prompt.html

https://github.com/debarshiray/toolbox/issues/190
This commit is contained in:
Calvin Ling 2019-06-14 21:39:35 +00:00 committed by Debarshi Ray
parent cbef52527f
commit bc1a816ea3

View file

@ -25,7 +25,7 @@ fi
if [ -f /run/.containerenv ] \
&& [ -f /run/.toolboxenv ]; then
PS1=$(printf "\033[35m⬢\033[0m%s" "[\u@\h \W]\\$ ")
PS1=$(printf "\[\033[35m\]⬢\[\033[0m\]%s" "[\u@\h \W]\\$ ")
if ! [ -f "$toolbox_welcome_stub" ]; then
echo ""