abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.31k stars 338 forks source link

swiper-isearch does not honor ivy-case-fold-search #2934

Open Addlai opened 2 years ago

Addlai commented 2 years ago

If I use the hydra binding C-o, C for ivy-toggle-case-fold in swiper-isearch the highlighting reflects a case-fold search, but the actual matches is not changed, so swiper-isearch continues to visit matches ignoring case.

daanturo commented 2 years ago

I met the same problem. It's odd that swiper-isearch's candidates are updated instantly after ivy-toggle-regexp-quote.

After looking at ivy-toggle-regexp-quote and ivy-toggle-case-fold's definition, I have seen that while the former has (setq ivy--old-text ""), the latter doesn't. Adding (setq ivy--old-text "") to the end of ivy-toggle-case-fold does the job (swiper-isearch now re-compute candidates immediately afterwards).

While submitting a PR for this is simple, I don't know enough of ivy's internals: the reason why ivy-toggle-regexp-quote modifies ivy--old-text but ivy-toggle-case-fold doesn't.