diff --git a/src/highlighters.cc b/src/highlighters.cc index 07db6e15..7bfa30cd 100644 --- a/src/highlighters.cc +++ b/src/highlighters.cc @@ -404,7 +404,7 @@ void expand_unprintable(const Context& context, DisplayBuffer& display_buffer) end = buffer.iterator_at(atom_it->end()); it != end; ++it) { Codepoint cp = *it; - if (cp != '\n' and iscntrl((int)cp)) + if (cp != '\n' and not iswprint(cp)) { std::ostringstream oss; oss << "U+" << std::hex << cp; diff --git a/src/normal.cc b/src/normal.cc index be2703ca..fced40c6 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -375,7 +375,7 @@ void view_commands(Context& context, int param) void replace_with_char(Context& context, int) { on_next_key_with_autoinfo(context, [](Key key, Context& context) { - if (not isprint(key.key)) + if (not iswprint(key.key)) return; ScopedEdition edition(context); Buffer& buffer = context.buffer(); diff --git a/src/unicode.hh b/src/unicode.hh index fb235fad..9485a27d 100644 --- a/src/unicode.hh +++ b/src/unicode.hh @@ -3,6 +3,7 @@ #include #include +#include namespace Kakoune { @@ -29,13 +30,13 @@ enum WordType { Word, WORD }; template inline bool is_word(Codepoint c) { - return c == '_' or isalnum(c); + return c == '_' or iswalnum(c); } template<> inline bool is_word(Codepoint c) { - return !is_blank(c) and !is_eol(c); + return not is_blank(c) and not is_eol(c); } inline bool is_punctuation(Codepoint c)