Closed QuarticCat closed 1 year ago
Hi @QuarticCat, thanks for opening a PR!
Could you provide a screenshot of the issue and this fix?
Preparation:
$ alias -g :bg!='&>/dev/null &!'
Before:
After:
CC @vladdoster
@QuarticCat What version of Zsh are you using?
@vladdoster 5.8.1
I have a hunch the current checks aren't super accurate :/.
Would you be up to writing a unit test for this change? Either in Zunit (example of zunit) or the existing test framework in this repository? I assume it will be consistent results across systems and a handful of Zsh versions, but don't want to test by hand.
Have you run the zinit tests locally?
No. I don't know how to write a unit test for it. And I'm not keen on learning how to do it cuz I'm not even familiar with ZSH.
I have some global aliases. All of them start with a
:
. Particularly, one of them is named:bg!
.I also wrote a completion for them.
This completion will automatically escape my selection, e.g.,
:bg!
->:bg\!
. This totally makes sense since sometimes we may choose a completion content that contains some special characters like a filename containing a\n
. And!
will be escaped because I enabled history expansion, which gives!
some special meanings in some contexts.Here comes the problem,
:bg\!
is a valid global alias and will be expanded by ZSH. However, f-sy-h cannot correctly highlight it.ZSH provides a flag
(Q)
that can remove an escape. So simply replace${+galiases[(e)$xxx]}
with${+galiases[(e)${(Q)xxx}]}
in file/fast-highlight
then it seems work. I don't know if I should also modifychroma/-alias.ch
and other places.