diff --git a/src/SendCommands.cc b/src/SendCommands.cc index 79a7515b..54809309 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -416,7 +416,7 @@ void send_text(shared_ptr c, StringWriter& w, uint16_t command, string data = encode_sjis(text); add_color(w, data.c_str(), data.size()); } else { - add_color(w, text); + add_color(w, text, char16len(text)); } while (w.str().size() & 3) { w.put_u8(0); diff --git a/src/Text.hh b/src/Text.hh index 335cdce5..d7cc99d0 100644 --- a/src/Text.hh +++ b/src/Text.hh @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -110,7 +111,7 @@ size_t add_color_inplace(T* a, size_t max_chars) { } template -void add_color(StringWriter& w, const T* src, size_t max_input_chars = SIZE_T_MAX) { +void add_color(StringWriter& w, const T* src, size_t max_input_chars) { for (size_t x = 0; (x < max_input_chars) && *src; x++) { if (*src == '$') { w.put('\t');