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
commitbb79b0116213952fc04cda5a0e7c9a306650b151 (patch)
tree9b1ebfc3f356d02b866b0a5fd514cfd9d80806cf /home
parentAdd "private" alias to source encrypted file (diff)
downloadsrc-bb79b0116213952fc04cda5a0e7c9a306650b151.tar.gz
src-bb79b0116213952fc04cda5a0e7c9a306650b151.zip
Cut off path components until right prompt fits
Keeps paths valid (from somehwere) rather than abrupt truncation.
Diffstat (limited to 'home')
-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}"
 }