aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/charset.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-06-23 23:40:34 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-07-01 08:45:13 -0400
commit6ff892165a6e3edd20ce31ba7c9a4af458684aca (patch)
treeb2082d9e516459a196ac90edc4c890bfdd0b04b9 /src/nvim/charset.c
parent70626e6a1eb9c82a5eb4e3b55abfd474908ef501 (diff)
downloadrneovim-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/charset.c')
-rw-r--r--src/nvim/charset.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 99ced6c8c2..d1d9de5487 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -842,7 +842,7 @@ bool vim_iswordc_tab(const int c, const uint64_t *const chartab)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
return (c >= 0x100
- ? (utf_class(c) >= 2)
+ ? (utf_class_tab(c, chartab) >= 2)
: (c > 0 && GET_CHARTAB_TAB(chartab, c) != 0));
}
@@ -866,10 +866,7 @@ bool vim_iswordc_buf(int c, buf_T *buf)
bool vim_iswordp(char_u *p)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
- if (MB_BYTE2LEN(*p) > 1) {
- return mb_get_class(p) >= 2;
- }
- return GET_CHARTAB(curbuf, *p) != 0;
+ return vim_iswordp_buf(p, curbuf);
}
/// Just like vim_iswordc_buf() but uses a pointer to the (multi-byte)
@@ -882,10 +879,12 @@ bool vim_iswordp(char_u *p)
bool vim_iswordp_buf(char_u *p, buf_T *buf)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
- if (MB_BYTE2LEN(*p) > 1) {
- return mb_get_class(p) >= 2;
+ int c = *p;
+
+ if (MB_BYTE2LEN(c) > 1) {
+ c = utf_ptr2char(p);
}
- return GET_CHARTAB(buf, *p) != 0;
+ return vim_iswordc_buf(c, buf);
}
/// Check that "c" is a valid file-name character.