Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

! ! ! breaks ivy--exhibit #976

Closed
Wilfred opened this issue Apr 26, 2017 · 3 comments · Fixed by #1186
Closed

! ! ! breaks ivy--exhibit #976

Wilfred opened this issue Apr 26, 2017 · 3 comments · Fixed by #1186

Comments

@Wilfred
Copy link
Contributor

Wilfred commented Apr 26, 2017

Typing "! ! ! " in the minibuffer with counsel-M-x produces:

Error in post-command-hook (ivy--exhibit): (error "Unexpected: use only one !")

This seems to happen with all counsel commands. Once this error has been triggered, ivy stops filtering results until you C-g and try again.

I'm using ivy--regex-ignore-order in ivy-re-builders-alist.

@abo-abo
Copy link
Owner

abo-abo commented May 2, 2017

Thanks, I did some testing to reproduce the bug.

(should (equal (ivy--regex-ignore-order "^v f") '(("^v" . t) ("f" . t))))
(should (equal (ivy--regex-ignore-order "^v ! f") '(("^v" . t) ("f"))))
(should (equal (ivy--regex-ignore-order "^v") '(("^v" . t))))
(should (equal (ivy--regex-ignore-order "^v! ") '(("^v" . t))))

The last test fails. Could you look into fixing it (if I remember correctly, some of ivy--regex-ignore-order code is yours)?

How it's supposed to work: everything after the last ! are negation groups, separated by spaces. They should not match, e.g. ("f" . nil) instead of ("f" . t) as in the test above.

But that means currently that it's impossible to match a literal !. My suggestion is to deal with exclamation marks same as with spaces: !! translates to a literal !, !!! to literal !! etc.

@Wilfred
Copy link
Contributor Author

Wilfred commented Jun 7, 2017

Ha, I bumped into this again today when trying to search for literal !. I'll try to write a PR.

How do you feel about using \! for a literal !? This would be more consistent with regexp special characters.

@abo-abo
Copy link
Owner

abo-abo commented Jun 8, 2017

That's fine as well.

Wilfred added a commit to Wilfred/swiper that referenced this issue Sep 6, 2017
This enables ivy--regex-ignore-order users to enter "foo\!" or "foo\ "
to match a literal ! or space. ivy--regex-plus attaches a different
meaning to spaces, so we do not support this escaping there.

It also fixes a crash if the user enters multiple !!!. We now just
discard these.

Fixes abo-abo#976.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants