diff options
author | Jurica Bradaric <jbradaric@gmail.com> | 2016-02-09 20:25:08 +0100 |
---|---|---|
committer | Jurica Bradaric <jbradaric@gmail.com> | 2016-02-09 23:08:24 +0100 |
commit | e8dd9967034c89d0493c7dffe13cfd08bab9e83a (patch) | |
tree | 185930f72340ee04c1ad822e2e89ebf825accbee /src/nvim/file_search.c | |
parent | 84281bf675f77f417d26a68611406ef43fd82f7f (diff) | |
download | rneovim-e8dd9967034c89d0493c7dffe13cfd08bab9e83a.tar.gz rneovim-e8dd9967034c89d0493c7dffe13cfd08bab9e83a.tar.bz2 rneovim-e8dd9967034c89d0493c7dffe13cfd08bab9e83a.zip |
vim-patch:7.4.835
Problem: Comparing utf-8 sequences does not handle different byte sizes
correctly.
Solution: Get the byte size of each character. (Dominique Pelle)
https://github.com/vim/vim/commit/f6470c288cb6f8efd60a507baf2c070f9d209ae6
Diffstat (limited to 'src/nvim/file_search.c')
-rw-r--r-- | src/nvim/file_search.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index b213a42c52..8c4a2f8275 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -1057,7 +1057,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l */ static int ff_wc_equal(char_u *s1, char_u *s2) { - int i; + int i, j; int prev1 = NUL; int prev2 = NUL; @@ -1067,18 +1067,19 @@ static int ff_wc_equal(char_u *s1, char_u *s2) if (s1 == NULL || s2 == NULL) return FALSE; - if (STRLEN(s1) != STRLEN(s2)) - return FAIL; - - for (i = 0; s1[i] != NUL && s2[i] != NUL; i += MB_PTR2LEN(s1 + i)) { + for (i = 0, j = 0; s1[i] != NUL;) { int c1 = PTR2CHAR(s1 + i); - int c2 = PTR2CHAR(s2 + i); + int c2 = PTR2CHAR(s2 + j); if ((p_fic ? vim_tolower(c1) != vim_tolower(c2) : c1 != c2) - && (prev1 != '*' || prev2 != '*')) + && (prev1 != '*' || prev2 != '*')) { return FAIL; + } prev2 = prev1; prev1 = c1; + + i += MB_PTR2LEN(s1 + i); + j += MB_PTR2LEN(s2 + j); } return TRUE; } |