* Update Textbuf type with its actual physical character and screenlength * Get the count of characters in the string as well as the width in pixels. * Useful when copying in a larger amount of text at once */
| 443 | * Useful when copying in a larger amount of text at once |
| 444 | */ |
| 445 | void Textbuf::UpdateSize() |
| 446 | { |
| 447 | this->chars = static_cast<uint16_t>(Utf8StringLength(this->buf) + 1); // terminating zero |
| 448 | assert(this->buf.size() < this->max_bytes); |
| 449 | assert(this->chars <= this->max_chars); |
| 450 | |
| 451 | this->caretpos = static_cast<uint16_t>(this->buf.size()); |
| 452 | this->UpdateStringIter(); |
| 453 | this->UpdateWidth(); |
| 454 | this->UpdateMarkedText(); |
| 455 | |
| 456 | this->UpdateCaretPosition(); |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Handle the flashing of the caret. |
no test coverage detected