jorgebucaran / hydro

Ultra-pure, lag-free prompt with async Git status—just for Fish
MIT License
697 stars 53 forks source link

Add support for weird characters in working dir #28

Closed giorgiga closed 2 years ago

giorgiga commented 2 years ago

The "big" change is adding string escape on the working directory (it's then passed through string unescape in fish_prompt).

While I was at it, I also made the style a bit more consistent and removed a little duplication.

This shoud fix #27 (ie. it does in my tests, but it's difficult to exclude there may be more strangeness).

There is still a potential issue if one is in a git directory and the path to the git "root" contains a colon (yes, quite the astral conjunciton :smile: ). This is because a colon as a magic value in string replace -- "/$toplevel/" /:/ to preserve the full unshortened (is it a word?) directory name of the git root... I guess it should be fixed by splitting the PWD in three portions (before the git root, git root segment, after the git root) and shortening parts 1 and 3 separately.

giorgiga commented 2 years ago

Gosh, I messed this one up: will submit a new PR shortly