summaryrefslogtreecommitdiffstats
path: root/src/charset.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-01-28 16:39:34 +0100
committerBram Moolenaar <Bram@vim.org>2017-01-28 16:39:34 +0100
commit4019cf90b8657d4ab1c39744db63550f44f405a2 (patch)
treedd19804e007e7748d0d2ca5a0e4aaa5dd0a19217 /src/charset.c
parentf42dd3c3901ea0ba38e67a616aea9953cae81b8d (diff)
patch 8.0.0252: not properly recognizing word characters between 128 and 255v8.0.0252
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)
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/charset.c b/src/charset.c
index e766fa5f6b..eb8baa9465 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -899,16 +899,17 @@ vim_iswordc(int c)
int
vim_iswordc_buf(int c, buf_T *buf)
{
-#ifdef FEAT_MBYTE
if (c >= 0x100)
{
+#ifdef FEAT_MBYTE
if (enc_dbcs != 0)
return dbcs_class((unsigned)c >> 8, (unsigned)(c & 0xff)) >= 2;
if (enc_utf8)
- return utf_class(c) >= 2;
- }
+ return utf_class_buf(c, buf) >= 2;
#endif
- return (c > 0 && c < 0x100 && GET_CHARTAB(buf, c) != 0);
+ return FALSE;
+ }
+ return (c > 0 && GET_CHARTAB(buf, c) != 0);
}
/*
@@ -917,21 +918,19 @@ vim_iswordc_buf(int c, buf_T *buf)
int
vim_iswordp(char_u *p)
{
-#ifdef FEAT_MBYTE
- if (has_mbyte && MB_BYTE2LEN(*p) > 1)
- return mb_get_class(p) >= 2;
-#endif
- return GET_CHARTAB(curbuf, *p) != 0;
+ return vim_iswordp_buf(p, curbuf);
}
int
vim_iswordp_buf(char_u *p, buf_T *buf)
{
+ int c = *p;
+
#ifdef FEAT_MBYTE
- if (has_mbyte && MB_BYTE2LEN(*p) > 1)
- return mb_get_class(p) >= 2;
+ if (has_mbyte && MB_BYTE2LEN(c) > 1)
+ c = (*mb_ptr2char)(p);
#endif
- return (GET_CHARTAB(buf, *p) != 0);
+ return vim_iswordc_buf(c, buf);
}
/*