Fix text edit buffer underrun.

PiperOrigin-RevId: 723474334
Change-Id: Ibff6d83d67275e6c6333a00cabe33967913dceb1
This commit is contained in:
Yuval Tassa
2025-02-05 05:35:36 -08:00
committed by Copybara-Service
parent 0d4bc1de00
commit 49d07c6100
+1 -1
View File
@@ -1106,7 +1106,7 @@ static void revealcursor(mjrRect r, mjUI* ui, const mjrContext* con) {
// scan backwards
int i = ui->editcursor;
while (width >= 0 && i >= ui->editscroll) {
while (width >= 0 && i >= ui->editscroll && i > 0) {
i--;
width -= con->charWidth[(unsigned char)ui->edittext[i]];
}