summary refs log tree commit diff
path: root/home
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-18 01:07:05 -0400
committerJune McEnroe <june@causal.agency>2018-08-18 01:07:05 -0400
commit43a0a0f04ed97d59b6994ba880e6ce31cf368724 (patch)
treec23e8a5acec7dc634008c600b9d7bb1e314cb9c2 /home
parentAdd "private" alias to source encrypted file (diff)
downloadsrc-43a0a0f04ed97d59b6994ba880e6ce31cf368724.tar.gz
src-43a0a0f04ed97d59b6994ba880e6ce31cf368724.zip
Cut off path components until right prompt fits
Keeps paths valid (from somehwere) rather than abrupt truncation.
Diffstat (limited to '')
-rw-r--r--home/.kshrc4
1 files changed, 3 insertions, 1 deletions
diff --git a/home/.kshrc b/home/.kshrc
index b0b225e9..734d71b7 100644
--- a/home/.kshrc
+++ b/home/.kshrc
@@ -76,7 +76,9 @@ function prompt {
 
 	[[ $TERM = xterm* ]] && title="\033]0;${title}\07" || title=''
 	[[ -n ${COLUMNS:-} ]] && cols=$COLUMNS || cols=$(tput cols)
-	typeset -R $(( cols / 2 )) right
+	while (( ${#right} > (cols / 2) )); do
+		right=${right#*/}
+	done
 	typeset -R $(( cols - 1 )) right
 	print "\01\r\01${title}\01\n\01${fg[7]}${right}${fg}\r\01${left}"
 }