1
0
Fork 0

Fix #13668, fd2949d: Include the `\0` in TextBuf max_chars cropping

pull/13672/head
glx22 2025-02-28 02:07:16 +01:00
parent ddb502d097
commit f8e535a098
1 changed files with 1 additions and 1 deletions

View File

@ -427,7 +427,7 @@ void Textbuf::Assign(const std::string_view text)
/* Make sure the name isn't too long for the text buffer in the number of
* characters (not bytes). max_chars also counts the '\0' characters. */
auto iter = this->buf.begin();
for (size_t len = 0; len < this->max_chars && iter != this->buf.end(); ++len) Utf8Consume(iter);
for (size_t len = 1; len < this->max_chars && iter != this->buf.end(); ++len) Utf8Consume(iter);
if (iter != this->buf.end()) {
this->buf.erase(iter, this->buf.end());