Case sensitivity invoked by using an uppercase letter #166

Closed
ardpp opened this Issue Jul 1, 2015 · 5 comments

Projects

None yet

2 participants

@ardpp
ardpp commented Jul 1, 2015

isearch has by default the nice property that a search becomes case sensitiv once an uppercase letter is used. It would be nice to have such behaviour in swiper as well.

@abo-abo abo-abo added a commit that closed this issue Jul 1, 2015
@abo-abo Bind case-fold-search to t when the input is all lower-case
* ivy.el (ivy--filter): Update.

* ivy-test.el (ivy--filter): Add test.

- input "the" matches both "the" and "The".
- input "The" matches only "The".

Fixes #166
f6f3963
@abo-abo abo-abo closed this in f6f3963 Jul 1, 2015
@abo-abo
Owner
abo-abo commented Jul 1, 2015

Thanks.

@ardpp
ardpp commented Jul 1, 2015

Don't know why, but it is not working as expected for me. I do have the newest version of swiper from melpa with the responsible line
(case-fold-search (string= name (downcase name)))

@abo-abo
Owner
abo-abo commented Jul 2, 2015

Try this one:

(ivy-read "Prompt: " '("the" "The" "one" "two"))

th should match two candidates, while Th should match only one.

@ardpp
ardpp commented Jul 2, 2015

When I evaluate this expression in the scratch buffer it does work as expected. But if I invoke swiper in a buffer that looks like that

the 
The

th matches two candidates and Th one. So this works also as expected (I was wrong before!).
However in both cases both "the" and "The" are highlighted. That is why I got mistaken in the first place.

@abo-abo
Owner
abo-abo commented Jul 2, 2015

Yeah, the swiper highlighter is pretty naive at this point. If you set the matcher to fuzzy it still highlights in the old way. I'll have to fix that at some point, but it's not a small task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment