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)
Always show complete current dir when shortening path

When LP_PATH_KEEP=0 and current dirname were over maximum length the
name was also shorten. With this fixed _lp_shorten_path should now
always return at least the complete current dirname.
Check if root when striping trailing slash
Remove unneeded local keyword
shorten path: properly escape \ (bash) or % (zsh)
DIRTRIM: fix comment explaining how to enable the feature
Merge branch 'polyphemus/refactor-shorten_path' into develop

Improve _lp_shorten_path for less code and more reliability.
A great contibution by Rolf Morel.
Credit polyphemus
Refactor LP_PERM
Refactor VIRTUAL_ENV support for improved speed
VIRTUALENV: avoid usage of 'basename' (external command)
Merge branch 'develop' of github.com:nojhan/liquidprompt into develop

* 'develop' of github.com:nojhan/liquidprompt:
  VIRTUALENV: avoid usage of 'basename' (external command)
  Refactor VIRTUAL_ENV support for improved speed
  Refactor LP_PERM
  Credit polyphemus
  DIRTRIM: fix comment explaining how to enable the feature
  shorten path: properly escape \ (bash) or % (zsh)
  Remove unneeded local keyword
  Check if root when striping trailing slash
  Always show complete current dir when shortening path
  fix promblematic shorten path function