diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-06-23 23:40:34 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-07-01 08:45:13 -0400 |
commit | 6ff892165a6e3edd20ce31ba7c9a4af458684aca (patch) | |
tree | b2082d9e516459a196ac90edc4c890bfdd0b04b9 /src/nvim/mbyte.c | |
parent | 70626e6a1eb9c82a5eb4e3b55abfd474908ef501 (diff) | |
download | rneovim-6ff892165a6e3edd20ce31ba7c9a4af458684aca.tar.gz rneovim-6ff892165a6e3edd20ce31ba7c9a4af458684aca.tar.bz2 rneovim-6ff892165a6e3edd20ce31ba7c9a4af458684aca.zip |
vim-patch:8.0.0252: not properly recognizing word characters between 128 and 255
Problem: Characters below 256 that are not one byte are not always
recognized as word characters.
Solution: Make vim_iswordc() and vim_iswordp() work the same way. Add a test
for this. (Ozaki Kiichi)
https://github.com/vim/vim/commit/4019cf90b8657d4ab1c39744db63550f44f405a2
Diffstat (limited to 'src/nvim/mbyte.c')
-rw-r--r-- | src/nvim/mbyte.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index ea538fb4fc..65a1a8246c 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -428,7 +428,7 @@ int mb_get_class_tab(const char_u *p, const uint64_t *const chartab) } return 1; } - return utf_class(utf_ptr2char(p)); + return utf_class_tab(utf_ptr2char(p), chartab); } /* @@ -1039,7 +1039,12 @@ bool utf_printable(int c) * 1: punctuation * 2 or bigger: some class of word character. */ -int utf_class(int c) +int utf_class(const int c) +{ + return utf_class_tab(c, curbuf->b_chartab); +} + +int utf_class_tab(const int c, const uint64_t *const chartab) { /* sorted list of non-overlapping intervals */ static struct clinterval { @@ -1122,11 +1127,13 @@ int utf_class(int c) /* First quick check for Latin1 characters, use 'iskeyword'. */ if (c < 0x100) { - if (c == ' ' || c == '\t' || c == NUL || c == 0xa0) - return 0; /* blank */ - if (vim_iswordc(c)) - return 2; /* word character */ - return 1; /* punctuation */ + if (c == ' ' || c == '\t' || c == NUL || c == 0xa0) { + return 0; // blank + } + if (vim_iswordc_tab(c, chartab)) { + return 2; // word character + } + return 1; // punctuation } /* binary search in table */ |