Fix more bad code for LP_ENABLE_TITLE
Fix one more portability hack that was really inefficient.
This commit is contained in:
parent
10a3ecb17c
commit
e883c8e41d
12
liquidprompt
12
liquidprompt
@ -106,6 +106,11 @@ case "$LP_OS" in
|
|||||||
SunOS) _lp_CPUNUM=$( kstat -m cpu_info | grep -c "module: cpu_info" ) ;;
|
SunOS) _lp_CPUNUM=$( kstat -m cpu_info | grep -c "module: cpu_info" ) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Extended regexp patterns for sed
|
||||||
|
# GNU/BSD sed
|
||||||
|
_LP_SED_EXTENDED=r
|
||||||
|
[[ "$LP_OS" = Darwin ]] && _LP_SED_EXTENDED=E
|
||||||
|
|
||||||
|
|
||||||
# get current load
|
# get current load
|
||||||
case "$LP_OS" in
|
case "$LP_OS" in
|
||||||
@ -1471,11 +1476,8 @@ _lp_temperature() {
|
|||||||
_lp_as_text()
|
_lp_as_text()
|
||||||
{
|
{
|
||||||
# Remove colors from the computed prompt
|
# Remove colors from the computed prompt
|
||||||
case "$LP_OS" in
|
local pst
|
||||||
Linux|FreeBSD|OpenBSD|SunOS) local pst="$(echo $1 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")" ;;
|
pst="$(echo "$1" | sed -$_LP_SED_EXTENDED "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")"
|
||||||
Darwin) local pst="$(echo $1 | sed -E "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
# Remove escape sequences
|
# Remove escape sequences
|
||||||
# FIXME check the zsh compatibility
|
# FIXME check the zsh compatibility
|
||||||
|
Loading…
x
Reference in New Issue
Block a user