aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-01-14 22:34:02 -0800
committerKaz Kylheku <kaz@kylheku.com>2025-01-14 22:34:02 -0800
commit00b93a6e3f643130945d60081213c27faaeba199 (patch)
tree613310de5e46daca23ea33637e725ebd092a3bbd
parentf2a4af98772170d7a4f13faf5fa00398231d510d (diff)
downloadbasta-00b93a6e3f643130945d60081213c27faaeba199.tar.gz
basta-00b93a6e3f643130945d60081213c27faaeba199.tar.bz2
basta-00b93a6e3f643130945d60081213c27faaeba199.zip
Abruptly disappearing status bug.
- In the basta.update_status function's path abbreviating loop, we must test whether the path can be abbreviated, and bail, before doing the abbreviation. If we do the test after the abbreviation, we create a one off error where we bail the loop with an overlong status line that does not fit even though we could have abbreviated the path by one more component. And then the status line is surprisingly blanked.
-rw-r--r--basta.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/basta.sh b/basta.sh
index 045dcc9..804a2cf 100644
--- a/basta.sh
+++ b/basta.sh
@@ -83,10 +83,10 @@ basta.update_status()
local status="$esc[7m$status_date$esc[m $HOSTNAME $dots$pwd"
local status_len=$((${#status} - ${#status_esc}))
[ $status_len -le $COLUMNS ] && break
+ [ "${pwd#/*/}" == "$pwd" ] && break
pwd=${pwd#/}
pwd=/${pwd#*/}
dots='...'
- [ "${pwd#/*/}" == "$pwd" ] && break
done
status_len=$((${#status} - ${#status_esc}))