diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-11-27 18:13:29 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-11-27 18:16:21 +1100 |
| commit | 1553d91d278ff943c3545e3cb0728acbf4cf433d (patch) | |
| tree | 9d795b13e34e98199c005ba06bf6ffba8fec386a /src/unicode.hh | |
| parent | 6c54c4740d2144e897cad5b033ab160b3ab2ddff (diff) | |
Make '_' the default extra_word_chars, and remove built-in support
Fixes #2599
Diffstat (limited to 'src/unicode.hh')
| -rw-r--r-- | src/unicode.hh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/unicode.hh b/src/unicode.hh index 1dcc836b..d94fff8d 100644 --- a/src/unicode.hh +++ b/src/unicode.hh @@ -32,9 +32,9 @@ inline bool is_blank(Codepoint c) noexcept enum WordType { Word, WORD }; template<WordType word_type = Word> -inline bool is_word(Codepoint c, ConstArrayView<Codepoint> extra_word_chars = {}) noexcept +inline bool is_word(Codepoint c, ConstArrayView<Codepoint> extra_word_chars = {'_'}) noexcept { - return c == '_' or iswalnum((wchar_t)c) or contains(extra_word_chars, c); + return iswalnum((wchar_t)c) or contains(extra_word_chars, c); } template<> @@ -43,9 +43,9 @@ inline bool is_word<WORD>(Codepoint c, ConstArrayView<Codepoint>) noexcept return not is_blank(c); } -inline bool is_punctuation(Codepoint c) noexcept +inline bool is_punctuation(Codepoint c, ConstArrayView<Codepoint> extra_word_chars = {'_'}) noexcept { - return not (is_word(c) or is_blank(c)); + return not (is_word(c, extra_word_chars) or is_blank(c)); } inline bool is_basic_alpha(Codepoint c) noexcept |
