From bb79b0116213952fc04cda5a0e7c9a306650b151 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Sat, 18 Aug 2018 01:07:05 -0400 Subject: Cut off path components until right prompt fits Keeps paths valid (from somehwere) rather than abrupt truncation. --- home/.kshrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'home') 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}" } -- cgit 1.4.1