fix promblematic shorten path function
fix promblematic shorten path function

The previous implementation had shell specific paths which did not
produce the same result. It did not respect the maximum length which it
calculated. And for specific cases even repeated part of the path.

This implementation is portable across bash and zsh.
It respects maximum length strictly and only exceeds it when it has to
respect LP_PATH_KEEP leading dirs.
It adds support for only showing the current directory, without leading
ones. This fixes Issue #219.

(Rebased by Olivier Mengué on top of more recent changes in that
fucntion)

laurentbardin/liquidprompt,colinlieberman/liquidprompt,nojhan/liquidprompt,enrdstrm/liquidprompt,elementalvoid/liquidprompt,joshuarubin/dotfiles,tsbarnes/liquidprompt,tstone2077/liquidprompt,illwieckz/liquidprompt,alexprengere/liquidprompt,smadhueagle/liquidprompt,joshuarubin/dotfiles,mathieumd/liquidprompt,timhyson/liquidprompt,jaesivsm/liquidprompt,joshuarubin/dotfiles,jonathanjsimon/liquidprompt,tkuminecz/liquidprompt,dpilone/liquidprompt,kenrachynski/liquidprompt,BobHood/liquidprompt,joshuarubin/dotfiles,milouse/liquidprompt,tocomo/liquidprompt,dan-cleinmark/liquidprompt,pkkolos/liquidprompt,lyoshenka/liquidprompt,dtschan/liquidprompt