3 # update VCS information
6 # set variable debian_chroot if running in a chroot with /etc/debian_chroot
7 if [[ -z "$debian_chroot" ]] && [[ -r /etc/debian_chroot ]] ; then
8 debian_chroot="chroot: $(cat /etc/debian_chroot)"
14 (( TERMWIDTH = ${COLUMNS} - 1 ))
16 # Truncate the path if it's too long.
20 local promptsize=${#${(%):---(%n@%m:%l)---()--}}
21 local pwdsize=${#${(%):-%~}}
22 # for whatever reason this works better if set to 3 on systems where no acpi info is in prompt
25 # Finally see how long the acpi related prompt is
26 PR_APM_TEMP=${PR_APM//\${\(e\)PR_SLASH}/#}
27 PR_APM_LENGTH=${(e)PR_APM_TEMP//\${PR_(LIGHT|)(RED|GREEN|YELLOW|BLUE|MAGENTA|CYAN|WHITE)}/}
29 # The info i collect for my laptop is - well. long. As I usually have my terms in full screen
30 # mode that doesnt matter, there is enough space. But for some cases I may want smaller
31 # windows, so deal with it and make the acpi line smaller by dropping parts of it.
33 (( apmsize=${(e)#PR_APM_LENGTH} - 2 ))
35 while [[ "$promptsize + $pwdsize + $apmsize" -gt $TERMWIDTH ]]; do
36 (( TOOLONG=$TOOLONG + 1 ))
38 if [[ "$TOOLONG" -gt 5 ]]; then
42 (( apmsize=${(e)#PR_APM_LENGTH} - 2 ))
45 if [[ ${(e)#PR_APM_LENGTH} -gt 10 ]]; then
46 (( apmsize=${(e)#PR_APM_LENGTH} - 2 ))
51 if [[ "$promptsize + $pwdsize + $apmsize" -gt $TERMWIDTH ]]; then
52 ((PR_PWDLEN=$TERMWIDTH - $promptsize - $apmsize ))
54 PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $apmsize)))..${PR_HBAR}.)}"
57 if [[ "$PR_BARLENGTH" -lt "${#${(e)PR_FILLBAR}}" ]]; then
58 (( TOOLONG=$TOOLONG - 1 ))
59 if [[ "$TOOLONG" -lt 0 ]]; then
63 PR_BARLENGTH=${#${(e)PR_FILLBAR}}