1
0
Fork 0

Fix fd2949d: std::string can reallocate on insert()

pull/13581/head
Patric Stout 2025-02-16 15:14:06 +01:00 committed by Patric Stout
parent 3ade64954c
commit 2eb32ece6d
1 changed files with 1 additions and 1 deletions

View File

@ -132,7 +132,7 @@ bool Textbuf::InsertChar(char32_t key)
if (this->buf.size() + len < this->max_bytes && this->chars + 1 <= this->max_chars) {
/* Make space in the string, then overwrite it with the Utf8 encoded character. */
auto pos = this->buf.begin() + this->caretpos;
this->buf.insert(pos, len, '\0');
pos = this->buf.insert(pos, len, '\0');
Utf8Encode(pos, key);
this->chars++;
this->caretpos += len;