diff options
author | Bram Moolenaar <bram@vim.org> | 2012-07-19 17:18:26 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2012-07-19 17:18:26 +0200 |
commit | 95a7b0cc6876b00559a16682406ef3cb9727aff6 (patch) | |
tree | cabf296c2f2ba8e6e98d9e9939ff31c7d9aa31fe | |
parent | a21b14ceb57ab9be4d9d341bd26e04a18290a290 (diff) | |
download | vim-95a7b0cc6876b00559a16682406ef3cb9727aff6.tar.gz |
Problem: CTRL-P completion has a problem with multi-byte characters.
Solution: Check for next character being NUL properly. (Yasuhiro Matsumoto)
-rw-r--r-- | src/macros.h | 3 | ||||
-rw-r--r-- | src/search.c | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/src/macros.h b/src/macros.h index be3af9a5..9e3ba44b 100644 --- a/src/macros.h +++ b/src/macros.h @@ -259,6 +259,8 @@ * PTR2CHAR(): get character from pointer. */ #ifdef FEAT_MBYTE +/* Get the length of the character p points to */ +# define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1) /* Advance multi-byte pointer, skip over composing chars. */ # define mb_ptr_adv(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1 /* Advance multi-byte pointer, do not skip over composing chars. */ @@ -272,6 +274,7 @@ # define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p)) # define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p)) #else +# define MB_PTR2LEN(p) 1 # define mb_ptr_adv(p) ++p # define mb_cptr_adv(p) ++p # define mb_ptr_back(s, p) --p diff --git a/src/search.c b/src/search.c index 1db967de..e231a3a1 100644 --- a/src/search.c +++ b/src/search.c @@ -5141,7 +5141,7 @@ exit_matched: && !(compl_cont_status & CONT_SOL) #endif && *startp != NUL - && *(p = startp + 1) != NUL) + && *(p = startp + MB_PTR2LEN(startp)) != NUL) goto search_line; } line_breakcheck(); diff --git a/src/version.c b/src/version.c index 064af8b2..cd0d2d7d 100644 --- a/src/version.c +++ b/src/version.c @@ -715,6 +715,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 606, +/**/ 605, /**/ 604, |