1
0
Fork 0

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

pull/13745/head
Loïc Guilloux 2025-03-05 12:05:19 +01:00 committed by GitHub
parent 7723625823
commit 0ade7638df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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());