diff --git a/src/textbuf.cpp b/src/textbuf.cpp index eabeac919d..a35834079a 100644 --- a/src/textbuf.cpp +++ b/src/textbuf.cpp @@ -199,7 +199,7 @@ bool Textbuf::InsertString(std::string_view str, bool marked, std::optionalmarkend = insertpos + bytes; } - this->buf.insert(insertpos, str, bytes); + this->buf.insert(insertpos, str.substr(0, bytes)); this->chars += chars; if (!marked && !caret.has_value()) this->caretpos += bytes;