-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fix the case-(in)sensitivity related issues in the matcher #29
Comments
Hi @romix, The reason why current matching is lowering everything is because it works much faster then with IGNORECASE flag. I suggest to convert user input to lower case - in that case your example will find something. |
@FelikZ OK, so you do it for performance reasons. I see. In this case, how about lowercasing the search string/regex before you compile it? I think it should be done by your plugin just before the If you decide not to lowercase the search string/regex and expect users to do so before a call, I'd suggest to clearly document this. I.e. that different from the standard CtrlP matching function, your plugin expects all search strings/regexes to be in the lowercase to function properly. |
@romix I think this is good idea to do both - force lower case the query and document this. Again, idea behind this plugin is performance. If you know the way how to do insensitive searches with the same speed - it would be nice to share it :) |
@FelikZ Yes, I've run some benchmarks and re.IGNORECASE is much slower in many cases. |
@romix that sounds logical to me now, so I agree with that. |
The matcher currently seems to be always lower the strings, before it does the actual matching.
This is fine in most cases. But sometimes it leads to strange results. For example, if you are in a regex mode and you look just for a regex which is a simple string "MySubstring" (not the two uppercase letters), you won't get any results, even if the actual original line contains it. This happens, because the regex is case-sensitive, but the lines it is being matched against are not, since they are lowered.
You should probably either avoid lowering lines in some cases.
Or you should use the case insensitive matching mode for regexes, which can be easily done by replacing the current:
by
The text was updated successfully, but these errors were encountered: