Not to rain on your fine snippet but you can use negative offsets to index from the end of the string:
P="$PWD" [ ${#P} -gt $pwdmaxlen ] && P="$trunc_symbol${P: -$pwdmaxlen}"