-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Problem: search_stat not reset when pattern differs in case #17314
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
Conversation
Problem: search_stat not reset when pattern differs in case Solution: use STRNCMP instead of MB_STRNICMP macro There was a long standing todo comment, that using MB_STRNICMP is wrong. So let's change it to STRNCMP() instead. Even if it not handle multi-byte characters correctly, then Vim will rather recompute the search stat, instead of re-using the old (and possibly wrong) value. fixes: vim#17312 Signed-off-by: Christian Brabandt <cb@256bit.org>
@chrisbra, will this work for
It should work for utf8 and DBCS. But, the comment says:
So, the above version may not work for Big5, etc. An alternative approach is to implement a
|
Makes sense. I'll include your version then |
I'm confused. How does |
I think I was not clear. I meant using utf_strncmp() inside mb_strncmp:
I assumed non-utf8 multi-code chars are different from utf8 multi-code (from reading the comments) and that strncmp() will not work for them. I assumed that is why strncmp() was not used earlier. Let me verify this with some tests. |
STRNCMP("é", "é", 2) This returns In digraph notation:
Since EDIT: strcmp()/strncmp() also does not handle DBCS (Shift-JIS, Big5) correctly |
This case is not relevant here, since
Example? |
The correct solution seems to be to use Apologies for the earlier confusion. |
That's why I initially used |
Thanks. |
Problem: search_stat not reset when pattern differs in case (tahzibijafar) Solution: use STRNCMP instead of MB_STRNICMP macro There was a long standing todo comment, that using MB_STRNICMP is wrong. So let's change it to STRNCMP() instead. Even if it not handle multi-byte characters correctly, then Vim will rather recompute the search stat, instead of re-using the old (and possibly wrong) value. fixes: vim/vim#17312 closes: vim/vim#17314 vim/vim@670d0c1 Co-authored-by: Christian Brabandt <cb@256bit.org>
#34058) Problem: search_stat not reset when pattern differs in case (tahzibijafar) Solution: use STRNCMP instead of MB_STRNICMP macro There was a long standing todo comment, that using MB_STRNICMP is wrong. So let's change it to STRNCMP() instead. Even if it not handle multi-byte characters correctly, then Vim will rather recompute the search stat, instead of re-using the old (and possibly wrong) value. fixes: vim/vim#17312 closes: vim/vim#17314 vim/vim@670d0c1 Co-authored-by: Christian Brabandt <cb@256bit.org>
#34058) Problem: search_stat not reset when pattern differs in case (tahzibijafar) Solution: use STRNCMP instead of MB_STRNICMP macro There was a long standing todo comment, that using MB_STRNICMP is wrong. So let's change it to STRNCMP() instead. Even if it not handle multi-byte characters correctly, then Vim will rather recompute the search stat, instead of re-using the old (and possibly wrong) value. fixes: vim/vim#17312 closes: vim/vim#17314 vim/vim@670d0c1 Co-authored-by: Christian Brabandt <cb@256bit.org> (cherry picked from commit ec5f054)
#34058) Problem: search_stat not reset when pattern differs in case (tahzibijafar) Solution: use STRNCMP instead of MB_STRNICMP macro There was a long standing todo comment, that using MB_STRNICMP is wrong. So let's change it to STRNCMP() instead. Even if it not handle multi-byte characters correctly, then Vim will rather recompute the search stat, instead of re-using the old (and possibly wrong) value. fixes: vim/vim#17312 closes: vim/vim#17314 vim/vim@670d0c1 Co-authored-by: Christian Brabandt <cb@256bit.org> (cherry picked from commit ec5f054)
Problem: search_stat not reset when pattern differs in case
Solution: use STRNCMP instead of MB_STRNICMP macro
There was a long standing todo comment, that using MB_STRNICMP is wrong. So let's change it to STRNCMP() instead. Even if it not handle multi-byte characters correctly, then Vim will rather recompute the search stat, instead of re-using the old (and possibly wrong) value.
fixes: #17312