commit 093137cdbafc106bedd53189d37265d5d3f5d669 parent 4c9afc91a5e0669abb6e35be395ee80f6ed7f150 Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com> Date: Fri, 4 Nov 2016 18:53:16 +0100 Concatenate instead of echoing TODO: measure whether this actually changes anything. Diffstat:
| M | .bashprompt | | | 24 | +++++++++++++----------- |
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/.bashprompt b/.bashprompt @@ -40,14 +40,14 @@ __fontify () codes[dim]='2' codes[clear]='0' - local string=$1 + local text=$1 shift # We need to add \[ \] around CSI sequences so that Bash can tell which # characters are non-printing. - __start-nonprinting - echo -en '\033[' + output=$(__start-nonprinting) + output+='\033[' local attributes=($@) local nb=$# @@ -55,22 +55,24 @@ __fontify () for ((i=0; i<nb; i++)) do a=${attributes[${i}]} - echo -en ${codes[${a}]} + output+=${codes[${a}]} if ((i<nb-1)) then - echo -en ';' + output+=';' else - echo -en 'm' + output+='m' fi done - __end-nonprinting + output+=$(__end-nonprinting) - echo -n "${string}" - __start-nonprinting - echo -en "\033[0m" - __end-nonprinting + output+="${text}" + output+=$(__start-nonprinting) + output+='\033[0m' + output+=$(__end-nonprinting) + + echo -en "${output}" } __set-prompt ()