Mercurial > vim
comparison src/mbyte.c @ 10724:ae1c6bf22e5f v8.0.0252
patch 8.0.0252: not properly recognizing word characters between 128 and 255
commit https://github.com/vim/vim/commit/4019cf90b8657d4ab1c39744db63550f44f405a2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 28 16:39:34 2017 +0100
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 28 Jan 2017 16:45:04 +0100 |
parents | b726d3ea70bc |
children | 506f5d8b7d8b |
comparison
equal
deleted
inserted
replaced
10723:72cb227772e7 | 10724:ae1c6bf22e5f |
---|---|
893 return 1; | 893 return 1; |
894 } | 894 } |
895 if (enc_dbcs != 0 && p[0] != NUL && p[1] != NUL) | 895 if (enc_dbcs != 0 && p[0] != NUL && p[1] != NUL) |
896 return dbcs_class(p[0], p[1]); | 896 return dbcs_class(p[0], p[1]); |
897 if (enc_utf8) | 897 if (enc_utf8) |
898 return utf_class(utf_ptr2char(p)); | 898 return utf_class_buf(utf_ptr2char(p), buf); |
899 return 0; | 899 return 0; |
900 } | 900 } |
901 | 901 |
902 /* | 902 /* |
903 * Get class of a double-byte character. This always returns 3 or bigger. | 903 * Get class of a double-byte character. This always returns 3 or bigger. |
2692 * 2 or bigger: some class of word character. | 2692 * 2 or bigger: some class of word character. |
2693 */ | 2693 */ |
2694 int | 2694 int |
2695 utf_class(int c) | 2695 utf_class(int c) |
2696 { | 2696 { |
2697 return utf_class_buf(c, curbuf); | |
2698 } | |
2699 | |
2700 int | |
2701 utf_class_buf(int c, buf_T *buf) | |
2702 { | |
2697 /* sorted list of non-overlapping intervals */ | 2703 /* sorted list of non-overlapping intervals */ |
2698 static struct clinterval | 2704 static struct clinterval |
2699 { | 2705 { |
2700 unsigned int first; | 2706 unsigned int first; |
2701 unsigned int last; | 2707 unsigned int last; |
2778 /* First quick check for Latin1 characters, use 'iskeyword'. */ | 2784 /* First quick check for Latin1 characters, use 'iskeyword'. */ |
2779 if (c < 0x100) | 2785 if (c < 0x100) |
2780 { | 2786 { |
2781 if (c == ' ' || c == '\t' || c == NUL || c == 0xa0) | 2787 if (c == ' ' || c == '\t' || c == NUL || c == 0xa0) |
2782 return 0; /* blank */ | 2788 return 0; /* blank */ |
2783 if (vim_iswordc(c)) | 2789 if (vim_iswordc_buf(c, buf)) |
2784 return 2; /* word character */ | 2790 return 2; /* word character */ |
2785 return 1; /* punctuation */ | 2791 return 1; /* punctuation */ |
2786 } | 2792 } |
2787 | 2793 |
2788 /* binary search in table */ | 2794 /* binary search in table */ |